Closed oxsd closed 4 years ago
FYI:
Added the following to package.json
:
"jest": {
"testMatch": [
"Z:/myproject/**/*.(spec|test).{ts,tsx,js,jsx}"
]
}
The testMatch
was then the value provided in package.json
.
Not sure that this a problem in TSDX or upstream. The built-in config's testMatch
is pretty simple:
testMatch: ['<rootDir>/**/*.(spec|test).{ts,tsx,js,jsx}']
It's possible the mapped drive is causing problems with path resolution, but TSDX's path resolution is fairly simple too:
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
export const appDirectory = fs.realpathSync(process.cwd());
export const resolveApp = function(relativePath: string) {
return path.resolve(appDirectory, relativePath);
};
resolveApp('.')
is what is used as the rootDir
.
If the path resolution were the problem however, that would cause issues in lots of other places. It's used all over, not just for tsdx test
. So sounds more of an upstream issue but I'm not totally sure.
The
testMatch
was then the value provided inpackage.json
.
Yes, you can use pacakge.json.jest
or jest.config.js
to further configure Jest; it'll be shallow-merged with TSDX's built-in config. This made me realize that his behavior is apparently not documented though o.o (it's existed for a pretty long time now), but it behaves the same as ESLint configs do with TSDX.
Thanks!
Definately is an upstream issue with Jest since it's the only place the error came up and configging jest fixed it.
Current Behavior
When using a mapped drive, the Test Match Pattern is incorrect.
For example:
If:
Z:
is mapped to\\server\projects\
Z:\myproject
Test match ends up
Z:/server/projects/myproject/**/*.(spec|test).{ts.tsx.js.jsx}
.Expected behavior
Test match should either be:
//server/projects/myproject/**/*.(spec|test).{ts.tsx.js.jsx}
orZ:/myproject/**/*.(spec|test).{ts.tsx.js.jsx}
.Your environment