Skip to content
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

Module ts-jest in transform not found. Solved? #6051

Closed
jhr007 opened this issue Apr 23, 2018 · 5 comments
Closed

Module ts-jest in transform not found. Solved? #6051

jhr007 opened this issue Apr 23, 2018 · 5 comments

Comments

@jhr007
Copy link

jhr007 commented Apr 23, 2018

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:
#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:
jest-community/vscode-jest#304

@thymikee
Copy link
Collaborator

Looks like the same issue: #5563. I'll close this one, but please join discussion there with your findings.

@xameeramir
Copy link

It's still broken!!

@evandrocoan
Copy link

It's still broken!!

@anyexinglu
Copy link

It's still broken!!

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants