cypress-and-jest icon indicating copy to clipboard operation
cypress-and-jest copied to clipboard

Error: Can't walk dependency graph: Cannot find module

Open dsacramone opened this issue 4 years ago • 0 comments

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;
};

dsacramone avatar Oct 07 '20 20:10 dsacramone