Open kran6a opened 2 years ago
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 TS_CONFIG_PATHS=true
before ts-mocha
, like this:
"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'",
cross-env
is for windows environment.
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
> hello-app@1.0.0 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 havetsconfig-paths
installed.This is my current config: package.json
tsconfig.json
Environment