cypress-and-jest
cypress-and-jest copied to clipboard
Error: Can't walk dependency graph: Cannot find module
Hey, I am experiencing an issue when I add this bit into my plugins file:
on('file:preprocessor', require('@cypress/code-coverage/use-browserify-istanbul'));
stack is: React/Typescript/Webpack/Jest/Cypress
Seems it can't follow imports from the root src directory. Node module imports are fine. I have aliased my imports. When remove that line above, all works as before. When I added, things break. I tried not aliasing files, same error.
import {CONSTANT1, CONSTANT2, CONSTANT3} from 'mocks/constants'; <-- breaks
import {UTIL_CONSTANT1} from 'utils/auth'; <--- breaks
import set from 'lodash/set'; <--- fine
import get from 'lodash/get'; <--- fine
import {CONSTANT1, CONSTANT2, CONSTANT3} from '../../src/mocks/constants'; <-- also breaks
import {UTIL_CONSTANT1} from '../../src/utils/auth'; <--- also breaks
full plugin file:
module.exports = (on, config) => {
const options = {
webpackOptions: require('../../tools/webpack.config')({ env: 'dev' }),
};
on('file:preprocessor', wp(options));
// cypress coverage
require('@cypress/code-coverage/task')(on, config);
on('file:preprocessor', require('@cypress/code-coverage/use-browserify-istanbul'));
return config;
};