Closed barrettluke closed 5 years ago
It looks like you're trying to configure wallaby with a json
file instead of as a javascript
file. From what you've provided, it looks like what you need is this:
module.exports = function(wallaby) {
return {
files: [
"src/**/*.js(x)",
"!src/**/*.spec.js(x)",
"package.json",
".babelrc.js",
"jest.config.js(x)"
],
tests: [
"src/**/*.spec.js"
],
env: {
type: "node",
runner: "node"
},
testFramework: "jest",
compilers: {
"**/*.js": wallaby.compilers.babel()
},
"debug": true
}
};
If you're trying to configure a react
project then you may find additional details on configuring Wallaby with react in our docs.
on the site it says you can use json and I can get to the http://localhost:51245/ and it shows all my files and test files but just doesn't run them? Why would wallaby let me get that far but only require me to use a .js file ?
Under the covers, wallaby calls require()
on your config file. This will work for simple configurations that don't do any dynamic processing. Your compilers
section actually needs to run javascript code because it's referencing the wallaby
runtime argument and calling the .compilers.babel() function. Using json
, this comes across as a string instead of calling the function.
Okay I have it set up as .js
[Error] Runtime error: ● Validation Error:
[Error] Module ./config/jest/setup.js in the setupFiles option was not found.
[Error]
module.exports = function(wallaby) { return { compilers: { '*/.js': wallaby.compilers.babel(), },
'debug': true,
env: {
runner: 'node',
type: 'node',
},
files: [
'src/**/*.js(x)',
'!src/**/*.spec.js(x)',
'package.json',
'.babelrc.js',
'jest.config.js(x)',
],
testFramework: 'jest',
tests: [
'src/**/*.spec.js',
'src/**/**/*.spec.js',
],
};
};
// The paths to modules that run some code to configure or set up the testing environment before each test
setupFiles: ['
// The path to a module that runs some code to configure or set up the testing framework before each test
setupTestFrameworkScriptFile: '<rootDir>/config/jest/setupFramework',
It looks like your ./config/jest/setup.js
file won't be found by your files
patterns in your config. You'll need to add another item in the files
list to match./config/jest/setup.js
.
If that doesn't work for you, please provide us with a sample repo with the same structure/packages as your project and we will provide you with the working configuration.
Ok setting the '*/jest/.js', worked! Thanks again for all the help.
Issue description or question
I am trying to get wallaby working in vscode using wallaby.json and have been running into issues on the tests output saying [Error] Failed to run compilers on src/redux/initialData.spec.js, Error: Processor(s) for "src/*/.js" is specified incorrectly, must be an array of functions or a function. [Error] at process.internalTickCallback (internal/process/next_tick.js:70:11) Please let me know what I need to do. Thanks
Wallaby.json configuration file