Closed kfern closed 2 years ago
Same problem on windows 11 Related dependencies: "ts-mocha": "^8.0.0", "@types/mocha": "^9.0.0", "mocha": "^8.4.0",
Same problem on MacOS Monterey:
"mocha": "^9.2.2",
"ts-mocha": "^9.0.2",
"ts-node": "^10.7.0",
"tsconfig-paths": "^3.14.1",
"typescript": "^4.6.2",
This is actually a problem with the README.md
in this repository. ts-mocha
doesn't actually know anything about watching files... it just passes any arguments it doesn't recognize along to Mocha. The instructions here reference the --watch-extensions
argument, which has been replaced with --watch-files
, which expects a glob. Therefore, the example should be:
ts-mocha --paths -p src/ 'src/**/*.spec.ts' -w --watch-files 'src/**/*.ts'
https://github.com/piotrwitek/ts-mocha/issues/69#issuecomment-1077739875
Wow, this is huge. THANK YOU. I'd even open a PR against the README.md
to fix that.
For others with the same issue:
-p: relative or absolute path to a tsconfig.json (default: "./tsconfig.json")
Example with test folder, watching all ts files:
ts-mocha test/**/*.spec.ts -w --watch-files '**/*.ts'
Could you please open a PR with an update to the readme with your example snippet? I'll merge. Thanks
@piotrwitek Done!
Merged, thanks a lot 👍
Hi!
I'm using ts_mocha 8 but it's not re-running test cases on file changes.
My mocha command is
If I add watch and watch-extensions options the tests are run once and not rerun when the tests or source code is modified
It's a bug? Any idea how can I solve it?
SO: Ubuntu 21.04 node -v: v12.22.1
Related dependencies: "@types/mocha": "^9.0.0" "mocha": "^8.2.1" "ts-mocha": "^8.0.0"