Closed Cerberus closed 2 years ago
If specific jest-cli
like this..
testFramework: {
type: 'jest',
path: './node_modules/jest-cli',
},
It will throw another error.
[Info] TypeError: Cannot read properties of undefined (reading '_loadConfigDependencies')
[Info] at Object.<anonymous> (/Users/L/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.322/wallabyb955e0/runners/node/jest@0.4.3/initializer.js:621:25)
The postprocessor
is not called with Jest 27 + autoDetect
by design. With autoDetect
Wallaby is using Jest's pipeline of transformers and setup files and not using file postprocessor
at all (this way your test setup is guaranteed to work in both Wallaby and Jest CLI).
If you can let us know how/for what purposes you have been planning to use postprocessor
, we are happy to try to recommend native Jest pipeline way of doing it.
Personally I am using postprocessor
to make .wasm
file (that binding with JS) before running tests. Such as AssemblyScript. It's really useful for me.
Finally, I found the root cause.
As I tried a custom wallaby.js with testFramework: 'jest'
(v27), the wallaby core will internally resolve jest@0.4.3
(legacy).
So, just specify the version and everything works like a charm again.
testFramework: 'jest@24.8.0'
Have A Good Time for CODING!! : )
@Cerberus I'm trying to specify testFramework: 'jest@27.0.6'
and it says that Test framework [jest@27.0.6] is not supported
. But it seems to be supported for jest@24.8.0
because it doesn't throw such an error, and trying to reach this version of Jest.
Did I understand correctly that firstly you tried jest v27, but downgraded to jest@24.8.0
to make it work with testFramework
?
@letehaha - Wallaby's testFramework
property versioning is our internal integration version and does not relate to the version of jest you are using. I believe that @Cerberus was using jest@27.4.7
and setting their Wallaby testFramework to jest@24.8.0
(this is our internal integration version number).
Having said that, if you need to set this version, it sounds like you may be doing something wrong. As @ArtemGovorov said above:
Jest 27+ uses
autoDetect
by design. WithautoDetect
Wallaby is using Jest's pipeline of transformers and setup files and not using filepostprocessor
at all (this way your test setup is guaranteed to work in both Wallaby and Jest CLI).
Please let us know why you Jest Automatic Configuration is not working for you as we may be able to recommend a different (better) approach.
@letehaha, as he said above.
package.json
"jest": "27.4.7",
wallaby.js
testFramework: 'jest@24.8.0',
@smcenlly tbh I'm probably stuck in another place. I'm using a postprocessor
to use custom webpack config, and when I'm passing testFramework.configFile
I'm getting [Error] Failed to load configuration file: TypeError: Cannot read properties of undefined (reading 'indexOf')
. That's what I'm trying to fix, so I tried to use different approaches, because I think that I'm doing something wrong.
That's the Wallaby's config I have:
const webpackConfig = require('./compiler/web')[0]
module.exports = function (wallaby) {
return {
// set `load: false` to all source files and tests processed by webpack
// (except external files),
// as they should not be loaded in browser,
// their wrapped versions will be loaded instead
files: [
{ pattern: 'client/src/**/*.+(js|vue)', load: false },
],
tests: [
{ pattern: 'client/test/unit/**/*.spec.js', load: false },
],
testFramework: {
configFile: './client/test/unit/jest.config.js',
},
postprocessor: wallaby.postprocessors.webpack(webpackConfig),
}
}
@letehaha - I think it's best to create a new issue for your problem.
Can you please describe your project and how you are running tests outside of Wallaby? You mention webpack
, but I can also see jest
in your configuration. Is it possible for you to provide a sample project with the same dependencies so we can examine your tech stack and see your tests working from the CLI?
Thanks @smcenlly, created this ticket https://github.com/wallabyjs/public/issues/3169
postprocessor
is not called with customwallaby.js
(Jest 27 +autoDetect
).Wallaby diagnostics report
–––
Try another config:
If I remove
autoDetect
and set wallaby config like this..postprocessor
is called, but got an internal error insteadDebugging Output:
Seem like not support jest v27, but v26 work fine.
Please help me check on this case. : )
–– More Info: wallaby core:
v1.0.1206
, OS: OSX