question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing instructions on how to use v3 with Jest and ts-node

See original GitHub issue

Reproduction

Well, just update the lib for a project that used Jest and ts-node.

Somewhat weird error messages start to appear in the output when running the tests: SyntaxError: Cannot use import statement outside a module

Expected behavior

The library would work like before. Another option is to add instructions about how to configure the library with a standard NodeJs environment that uses Jest and TypeScript.

Screenshots

Your Environment

software version
node-fetch 3
node 14
npm 6
Operating System macOS

Additional context

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:30
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
1999commented, Sep 8, 2021

I will probably stay on node-fetch@2 in my Typescript project for now.

9reactions
markuslcommented, Sep 6, 2021

@LinusU If I read that right it seems to be an experimental feature that is likely going to have breaking changes. That does not sound like something that we should include in a production code base.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest Typescript with ES Module in node_modules error
You don't have a tsconfig.json file that specifies module . Therefore it uses the default, where it transpiles all your modules to CommonJS ......
Read more >
ts-jest - npm
These instructions will get you setup to use ts-jest in your project. For more detailed documentation, please check online documentation. using ...
Read more >
Configuring Jest
You can use --config flag to pass an explicit path to the file. ... To read TypeScript configuration files Jest requires ts-node ....
Read more >
TypeScript - Cypress Documentation
Type "restart ts" and select the "TypeScript: Restart TS server." option. If that does not work, try restarting the IDE. Types for Custom...
Read more >
Jest | IntelliJ IDEA Documentation - JetBrains
Alternatively, select a test file in the Project tool window and select Create <filename> from the context menu. Specify the Node.js interpreter ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found