Closed nebosite closed 10 months ago
I don't reproduce this issue locally on macOS Ventura 13.2 with Node 16.14.2 or 20.11.0. Maybe it's a transient issue in a nested dependency? Maybe it's Windows-specific?
I'm charging an old Surface laptop to try on Windows 11 😄 . Will come back to this soon.
Aside: in general, it's not great practice to upload a .zip. Downloading and extracting arbitrary files from the internet is kind of scary for us maintainers 😄. I'd appreciate an isolated GitHub repository, Gist, Stackblitz, or other more transparent environment next time.
Here's a repro: https://github.com/JoshuaKGoldberg/repros/tree/mocha-typescript-watch-mode
Ok, yes, this doesn't reproduce for me on Windows 11 in stock cmd either. That, coupled with the lack of other reports on this area makes me suspect it was a transient issue in some other dependency. Closing as non-actionable.
Please do post back if it's still happening for you & you can provide an isolated reproduction with it. We'd be happy to take a look. Cheers!
Prerequisites
faq
labelnode_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend that you not install Mocha globally.Description
With a simple typescript project, mocha in watch mode works correctly at first, but after the second source code change detection, it loses compiled information.
Steps to Reproduce
npm run testwatch
(Result: there will be a passing test and a 'waiting for changes...' messageExpected behavior:
Starting with step 3, should see a normal test failure after each edit and save.
Actual behavior: [What actually happens]
After first edit: Normal test failure After second edit: Fails with: TypeError: Cannot read properties of undefined (reading 'getMessage') After third edit: Compile failure: src/FooClass.spec.ts:2:26 - error TS2306: File 'src/FooClass.ts' is not a module.
Reproduces how often:
100%
Versions
(I have also tried with earlier versions of mocha(8) and ts-node(9))
Node: 16.14.2 OS: Windows 11, 64 bit
mochaWatchFailure.zip