Open
Description
Environment
vscode-jest version
: [26.6.3]node -v
: [14.17.0]npm -v
oryarn --version
: [npm 6.14.13]- your vscode-jest settings if customized:
module.exports ={
moduleNameMapper: {
'\\.(css|scss)$': '<rootDir>/__mocks__/styleMock.js',
'^meteor/(.*)': '<rootDir>/__mocks__/meteorMocks.js'
},
transform: {
'^.+\\.js?$': 'babel-jest'
},
transformIgnorePatterns: ['node_modules/(?!@foobar)/'],
modulePaths:['<rootDir>/ui']
};
- anything else that you think might be relevant? [ ]
babel.config.json:
{
"plugins": ["@babel/plugin-proposal-class-properties",
"@babel/transform-runtime",
"@babel/plugin-proposal-optional-chaining",
["@babel/plugin-proposal-decorators", { "legacy": true }]
],
"presets": [
"@babel/preset-react",
"@babel/preset-env"
]
}
- Operating system: [Ubuntu 20.04.2 LTS]
Prerequisite
- are you able to run jest test from the command line? [No]
- how do you run your tests from the command line? (for example:
npm run test
ornode_modules/.bin/jest
) [npm run test]
Steps to Reproduce
Basically all I'm trying to do is import a module, but after many configurations I've tried none seem to work.
import ElementRenderer from '../ui/components/ElementRenderer';
describe('Something', ()=>{
it('should work', ()=>{
expect(3).toBe(3);
});
});
Expected Behavior
Run a simple test
Actual Behavior
Cannot find module '/ui/components/collectionEditor/utils' from 'ui/components/elements/collections/TablePagination.js'
Require stack:
ui/components/elements/collections/TablePagination.js
ui/components/elements/ChatWidget.js
ui/components/ElementRenderer.js
__tests__/first.test.js
Please note that I'm new to using jest and react, and any light on the issue will be highly appreciated! Thanks!
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...