Wallaby.js supports the Facebook Jest testing framework.

module.exports = function () {

  return {
    files: ['src/**/*.js', '!src/**/__tests__/*.js'],

    tests: ['src/**/__tests__/*.js'],

    env: {
      type: 'node',
      runner: 'node'
    },

    testFramework: 'jest'
  };
};

You may find the working sample of wallaby.js configuration for Jest in this repository.

jest

Please note that wallaby.js is using its own cache to run your tests from, not the local project folder. You should include all files (except node modules) that your tests need, for example __mocks__/*.*, etc.

Jest configuration

If Jest is configured using your package.json, wallaby will automatically load the configuration. If you would like to adjust the configuration, you may use the setup function, and pass require('package.json').jest to the wallaby.testFramework.configure function. Don’t forget to include package.json in your files list in this case.

 module.exports = function () {

   return {
     files: [
       'src/**/*.js',
       'package.json', // <--
       '!src/**/__tests__/*.js'
       ],

     tests: ['src/**/__tests__/*.js'],

     env: {
       type: 'node',
       runner: 'node'
     },

     testFramework: 'jest',

     setup: function (wallaby) {
       var jestConfig = require('./package.json').jest;
       jestConfig.globals = { "__DEV__": true };
       wallaby.testFramework.configure(jestConfig);
     }
   };
 };

If you have some other Jest config, or would like to override some configuration values, you may pass any config object to the configure function of the test framework in wallaby setup function.

Snapshot testing

It’s recommended to read the article about Jest snapshot testing workflow with wallaby.js.

You may also find a couple of snapshot testing notes/recipes with jest plus wallaby.js in this question discussion.

scriptPreprocessor

If you are using scriptPreprocessor for some source files that you’d like to see wallaby coverage for, you’ll need to use wallaby preprocessor or wallaby compiler instead. For example, TypeScript or CoffeeScript compiler or Babel compiler.