Can't run jest tests; preprocessCss not a function or module?

I tried running a test by clicking one of the green arrows beside my tests, and I got `Test suite failed to run; configuration 'preprocessCss' is not a function nor a valid path to module`. This is running jest tests, so I look at the run/debug configurations for Jest and see that it's pointing at `project/node_modules/jest` as the Jest package, and `C:\Program Files\nodejs\node.exe` as the Node interpreter. 

For reference, I can run Jest tests in my CLI, by calling `npm run test` which in turn runs `node_modules/.bin/jest`. I tried adding that as the path for Jest package but it wouldn't accept it. I also tried changing the Jest package path to `node_modules/babel-jest` but trying to run that gave me `Cannot find bin fine for 'babel-jest' package`.

 

0
7 comments

what does your test script look like exactly?

Sample project the issue can be repeated with would be helpful

0
Avatar
Permanently deleted user

My test script is simple, named 'assessor.spec.js':

describe('Assessor', () => {
it('should do things', () => {
expect(assessor(0, '0')).toBe(1);
expect(assessor(1, '1')).toBe(1);
expect(assessor(0, '1')).toBe(1);
expect(assessor(1, '0')).toBe(0);
});
});

 

0

I was asking about your npm test script:)

0
Avatar
Permanently deleted user

Not sure exactly what you mean; I have this in my `package.json`:

"test": "node_modules/.bin/jest",

Is that what you meant? That's not a script I've made/changed...

0

I see... node_modules/.bin/jest actually runs node node_modules\jest\bin\jest.js, so the results should be equal.

Could you share a test project the issue can be repeated with?

If it's not possible, please share screenshots of your run configuration and the console with the error

0
Avatar
Permanently deleted user

0

No clues unfortunately

Please try composing a sample project that shows up the issue - it can just be a dummy spec file like the one in https://intellij-support.jetbrains.com/hc/en-us/community/posts/360009448520/comments/360002023479, but the configuration (jest config, package.json, babel configuration, etc) should be the same

0

Please sign in to leave a comment.