-
Notifications
You must be signed in to change notification settings - Fork 25
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
ts-mocha does not resolve tsconfig path aliases when using ESM #74
Comments
Hey, thanks for your report. We would need a minimal reproduction repo and will fix that easily. Thanks! |
Hey, I face the same issue. Did you find a way to fix it? |
I face the same issue as well. |
I have the same alias pb, here is a small repo to reproduce it : https://github.com/dcaillibaud/ts-mocha-boilerplate Thanks for any clue to make it working. |
Try add "test": "cross-env TS_CONFIG_PATHS=true ts-mocha --recursive -n loader=ts-node/esm -n experimental-specifier-resolution=node -p tsconfig.json --paths 'tests/**/*.spec.ts'",
|
Same issue. @jiouiuw doesn't seem to work |
@furstenheim Hi, Sorry to hear that. Maybe you check this one? I try, It's worked https://github.com/ts-monorepo/basic/blob/main/apps/hello/package.json ➜ pnpm --filter=hello-app test
> [email protected] test /Users/jiouiuw/Projects/basic/apps/hello
> cross-env NODE_ENV=test TS_CONFIG_PATHS=true ts-mocha -p tsconfig.json src/**/*.test.ts --parallel --timeout 30000
before test
after test
tests
✔ test sum
1 passing (536ms) |
When trying to execute a test importing a path alias (
$lib
) I getCannot find package '$lib' imported from ...
.Tests that do not import path aliases are running fine and I don't know what's the problem since I am already using the --paths option and I have
tsconfig-paths
installed.This is my current config:
package.json
tsconfig.json
Environment
The text was updated successfully, but these errors were encountered: