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.

Module ts-jest in transform not found. Solved?

See original GitHub issue

I want to report a bug

What is the current behavior? I get an error running jest from a mapped network drive. Jest runs fine from a local drive.

I think this is related to: https://github.com/facebook/jest/issues/5563

Error

Validation Error:

  Module ts-jest in the transform option was not found.

  Configuration Documentation:
  https://facebook.github.io/jest/docs/configuration.html

To repeat:

mkdir C:\test
cd C:\test\
git clone git@github.com:jhr007/test-typescript-app.git
cd test-typescript-app
npm install 
net use x: \\localhost\C$\test

Open x:\test-typescript-app\ in VS Code and hit (F5) to debug it with (vscode-jest-tests configuration). and you should get the above error.

Open the same project from C:\test\test-typescript-app and the tests will run(tests didn’t pass for me but at least it got that far). test-typescript-app was created with create-react-app my-app --scripts-version=react-scripts-ts per create a typescript

I think I found the problem

It’s in how path#join (now?) handles network paths at path.join(prefix, aPath, moduleDir); https://github.com/facebook/jest/blob/master/packages/jest-resolve/src/node_modules_paths.js#L62

const path = require('path');

let prefix = '\\\\';
const aPath = '\\\\localhost\\C$\\test\\test-typescript-app';
const moduleDir = 'nodule_modules';

path.join(prefix, aPath, moduleDir); // returns '\\localhost....'  : Bad

prefix = '';
path.join(prefix, aPath, moduleDir); // returns '\\\\localhost....' : Good

Changing this line to prefix = ''; gets the tests to start/finish. https://github.com/facebook/jest/blob/master/packages/jest-resolve/src/node_modules_paths.js#L38 I just think this is the regex and I’m a test noob. I got the tests in my other project to run with the VS Code Jest Extension by changing that line.

Maybe Line 35 should be

 if (process.platform === 'win32') {
    prefix = '';
  } 

What is the expected behavior? I expect tests to run rather than getting an error.

Please provide your exact Jest configuration The commit adding jest config to package.json

Run npx envinfo --preset jest in your project directory and paste the results here

Original issue found using VS Code’s Jest plugin: https://github.com/jest-community/vscode-jest/issues/304

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

5reactions
xameeramircommented, Jun 13, 2020

It’s still broken!!

5reactions
thymikeecommented, Apr 23, 2018

Looks like the same issue: https://github.com/facebook/jest/issues/5563. I’ll close this one, but please join discussion there with your findings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest Testing with Bazel Throws "Module ts-jest in the transform ...
So it seems as if something with ts-jest is not working. When running jest manually, I don't get any errors. My [jest.config.js][2] in...
Read more >
ts-jest - npm
ts -jest. A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript. NPM version NPM...
Read more >
Angular >=13 | jest-preset-angular - GitHub Pages
To fix this issue, one should modify transformIgnorePatterns to be as following: JavaScript; TypeScript. module.exports = ...
Read more >
jest-transform-stub - npm Package Health Analysis | Snyk
The npm package jest-transform-stub was scanned for known vulnerabilities and missing license, and no issues were found. Thus the package was deemed as...
Read more >
jest module not found | The AI Search Engine You Control
1 Answer. I've had a similar issue and it goes down to typescript not being able to import that file. I've solved it...
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