-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
type stripping + module mocking causes test runner to throw #54428
Comments
I can't reproduce: import { before, mock } from 'node:test';
const logger = mock.fn();
before(async () => {
mock.module('./logger.ts', {
namedExports: { logger }
});
await import('./replace-js-ext-with-ts-ext.ts');
});
|
You can see it here: JakobJingleheimer/correct-ts-specifiers@6deda58 Just change the file extension of logger back to |
I am seeing the same issue when experimenting with these two flags. |
|
I haven't verified this issue, but I would expect it to be valid since the It might be that it's tricky to reproduce when ambiguous files are used? |
PR-URL: #54878 Fixes: #54428 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
PR-URL: #54878 Fixes: #54428 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
PR-URL: nodejs#54878 Fixes: nodejs#54428 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it>
Version
22.6.0
Platform
Subsystem
module
What steps will reproduce the bug?
logger.ts
)replace-js-ext-with-ts-ext.test.ts
)node --experimental-test-module-mocks --experimental-strip-types --test ./replace-js-ext-with-ts-ext.test.ts
)How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
It should behave the same as when the module mock target is a node builtin or a javascript file.
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: