-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not run and debug tests with AVA in VSCode. Typescript, ESM modules, with aliases (absolute paths) working. #55
Comments
BTW my "flattened" tsconfig in master branch:
|
You may have more luck asking in the main Discussions area: https://github.com/avajs/ava/discussions Personally I try and avoid the complications, and use (I'm closing this issue for housekeeping purposes, but let's keep the conversation going.) |
Thanks you for at least reading the post ;) I will try my luck in the main forum. |
I am trying to create a Typescript project with Ava testing where I could debug the code while tests are running. My setup used to just work (as described here) when I was using
commonjs
modules, but after switching toesm
I can not get it to work. I have spent hours and days looking for the right configuration and/or workaround for that.This is my current setup (master branch on repo) after switching to
esm
modules.Adding breakpoints and running the app
yarn start
correctly stops at breakpoints, but when runningyarn test
it does not stop at breakpoints.I was expecting the execution to stop at breakpoints in
app.ts
andtest.test.ts
filesWhat Iv'e tried so far:
esm-module-alias
to create custom loader. This fixes the issue of alias paths in generated.js
files, and allows debugging in vscode both with"start": "rm -rf dist && NODE_ENV=development tsx watch ./src/app/index.ts",
and"build_and_start_ema": "tsc && node --loader=./dist/app/alias.js ./dist/app/index.js",
commands. It also allows running ava tests with"test": "NODE_OPTIONS='--import=tsx' ava --config unittest.js",
,but does not allow debuging. (on master branch)tsconfig-paths
to fix aliased import paths in generated javascript - this does not even allow running the app after build phase. (on master branch)ts-patch
to fix aliased import paths in generated javascript - this does not allow running tests at all. See repo branch."build_tsca": "tsc --project tsconfig.json && tsc-alias -p tsconfig.json",
, which means I can not run tests continuously usingyarn test --watch
. See repo branch.Overall my best attempts were attempt 1 and 4, but attempt 1 is better because it allows running tests continuously.
How can I achieve being able to continously run and debug ava tests in vscode on a typescript project with ESM modules that uses aliased import paths, like it used to when I was using
commonjs
modules?The text was updated successfully, but these errors were encountered: