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
node-tap mocking alongside ts-node #1417
Comments
So as not to clutter the template, I'll add a couple notes here. Since the error says it occurs here https://github.com/TypeStrong/ts-node/blob/v10.1.0/src/index.ts#L1228 I speculate that https://github.com/TypeStrong/ts-node/blob/v10.1.0/src/index.ts#L1212 is at fault, based on the wording, and Per the docs, https://nodejs.org/dist/latest-v14.x/docs/api/modules.html#modules_require_extensions this API has been depreciated for some time, but I understand there is no other way to do this. nodejs/node#32483 Based on https://github.com/nodejs/node/blob/v14.16.1/test/parallel/test-module-multi-extensions.js#L20-L30, it appears that Node still tests that this works, so it does not appear to be broken. I have no idea where to hunt from here. |
https://nodejs.org/dist/latest-v14.x/docs/api/esm.html#esm_no_require_extensions Is it because I'm using No, |
A couple quick observations: Based on your reproduction, ts-node is throwing an internal error that it cannot find @types/node. I believe this is a separate bug which I've tracked here: #1419 Second, there's a syntax error in f.ts: https://github.com/TypeStrong/ts-node-repros/blob/1fd4007a3ffa335fd786e823b1a9011aabe454a6/test/f.ts |
Both fixed, thanks. Maybe we'll get the correct error now. |
I think f.ts still has a typo.
…On Thu, Aug 5, 2021, 12:10 AM Drazi Crendraven ***@***.***> wrote:
Both fixed, thanks. Maybe we'll get the correct error now.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1417 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OCUGKVE4DFCW6KM6VLT3IFKJANCNFSM5BSOC66Q>
.
|
There are two commits since I'm editing on web on mobile. I think the typo was fixed with the second one? Otherwise I'm not seeing it and will have to review tomorrow |
Yes, please test this locally, and when you're sure it is correct, I'll
rerun the reproduction.
…On Thu, Aug 5, 2021, 12:13 AM Drazi Crendraven ***@***.***> wrote:
There are two commits since I'm editing on web on mobile. I think the typo
was fixed with the second one? Otherwise I'm not seeing it and will have to
review tomorrow
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1417 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAC35OA74K6LVGV7RBB4Z6TT3IFYDANCNFSM5BSOC66Q>
.
|
It's ready to run now and is giving the "correct" error locally. |
still has a typo EDIT maybe spoke too soon |
Ok yeah, still has a typo in t.ts |
Where? It runs the tests and gives the error I expect. I'd be happy if the error was due to a typo. 👀 NM. Sorry to waste your time. :-/ I see the issue. I need to stop switching between tap and jest, it's just close enough syntax. |
This might work better as a different issue type, if so let me know.
Expected Behavior
I am able to mock require
Actual Behavior
I receive this relatively unhelpful (to me) error stack
Steps to reproduce the problem
This is probably partly related to the node-tap's way of mocking, which is documented here. https://node-tap.org/docs/api/mocks/#api
Minimal reproduction
Since my code is already quite short, pasting it here in it's entirety
The contents of the
dosStub.ts
file are a single exported class. Since this is arequire
error, I don't think the content of that file are relevant, but I will share if desired.TypeStrong/ts-node-repros#15
Specifications
Description: Manjaro Linux
Release: 21.1.0
The text was updated successfully, but these errors were encountered: