wallabyjs / public

Repository for Wallaby.js questions and issues
http://wallabyjs.com
759 stars 45 forks source link

Cannot find Jest test runner after upgrading from jest 26 to 27 #2771

Closed abalhier closed 3 years ago

abalhier commented 3 years ago

Issue description or question

Hello,

We have a monorepo with lerna and typescript. Since we upgraded to Jest 27.0.6 from 26, we get an error when launching Wallaby :

‍[Info]  Started Wallaby.js Core v1.0.1126
[Info]  Wallaby App (realtime reports) is available at: http://localhost:51245
[Error] Runtime error: Failed to initialize wallaby jest. 
[Error] Error: Cannot find Jest test runner 
[Error]     at Module._compile (internal/modules/cjs/loader.js:1085:14) 
[Error]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) 
[Error]     at Module.load (internal/modules/cjs/loader.js:950:32) 
[Error]     at Function.Module._load (internal/modules/cjs/loader.js:790:14) 
[Error]     at Module.require (internal/modules/cjs/loader.js:974:19) 
[Error]     at require (internal/modules/cjs/helpers.js:92:18) 
[Error]     at Module._compile (internal/modules/cjs/loader.js:1085:14) 
[Error]     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) 
[Error]     at Module.load (internal/modules/cjs/loader.js:950:32) 
[Error]     at Function.Module._load (internal/modules/cjs/loader.js:790:14) 
[Error]     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) 
[Error]     at internal/main/run_main_module.js:17:47 

Wallaby diagnostics report

{
  editorVersion: '1.59.0',
  pluginVersion: '1.0.302',
  editorType: 'VSCode',
  osVersion: 'darwin 20.6.0',
  nodeVersion: 'v14.17.3',
  coreVersion: '1.0.1126',
  checksum: 'MDU4NDA5N2UwMjVhMDdlZjI5NDQxMTkyMWFhODBlYzcsMTYzNTM3OTIwMDAwMCww',
  config: {
    files: [
      { pattern: 'packages/**/*.ts*', ignore: false, trigger: true, load: true, instrument: true, order: 1 },
      { pattern: 'packages/**/*.csv', ignore: false, trigger: true, load: true, instrument: true, order: 2 },
      { pattern: 'packages/**/*.json', ignore: false, trigger: true, load: true, instrument: true, order: 3 },
      { pattern: 'packages/*.js', ignore: false, trigger: true, load: true, instrument: true, order: 4 },
      { pattern: 'packages/**/*.d.ts', ignore: true, trigger: true, load: true, instrument: true },
      { pattern: 'packages/**/node_modules/**', ignore: true, trigger: true, load: true, instrument: true },
      { pattern: 'packages/**/*spec.ts', ignore: true, trigger: true, load: true, instrument: true },
      { pattern: 'packages/**/*spec.tsx', ignore: true, trigger: true, load: true, instrument: true },
      { pattern: 'packages/app/__mocks__/styleMock.js', ignore: false, trigger: true, load: true, instrument: true, order: 5 },
      { pattern: 'packages/**/*spec.ts.snap', ignore: false, instrument: false, trigger: true, load: true, order: 6 },
      { pattern: 'packages/**/*spec.tsx.snap', ignore: false, instrument: false, trigger: true, load: true, order: 7 },
      { pattern: 'packages/**/*slow.spec.ts.snap', ignore: true, instrument: false, trigger: true, load: true },
      { pattern: 'packages/**/*e2e.spec.ts.snap', ignore: true, instrument: false, trigger: true, load: true },
      { pattern: 'packages/**/node_modules/**.snap', ignore: true, instrument: false, trigger: true, load: true },
      { pattern: 'package.json', ignore: false, instrument: false, trigger: true, load: true, order: 8 }
    ],
    tests: [
      { pattern: 'packages/**/*spec.ts', ignore: false, trigger: true, load: true, test: true, order: 9 },
      { pattern: 'packages/**/*spec.tsx', ignore: false, trigger: true, load: true, test: true, order: 10 },
      { pattern: 'packages/**/*slow.spec.ts', ignore: true, trigger: true, load: true, test: true },
      { pattern: 'packages/**/*e2e.spec.ts', ignore: true, trigger: true, load: true, test: true },
      { pattern: 'packages/**/node_modules/**', ignore: true, trigger: true, load: true, test: true }
    ],
    compilers: { '**/*.ts?(x)': [Function (anonymous)], '**/*.?(lit)coffee?(.md)': [Function (anonymous)] },
    testFramework: { version: 'jest@0.4.3', configurator: 'jest@0.4.3', reporter: 'jest@0.4.3', starter: 'jest@0.4.3' },
    env: { type: 'node', runner: 'node', params: {}, viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
    diagnostics: {},
    filesWithNoCoverageCalculated: [],
    runAllTestsInAffectedTestFile: false,
    updateNoMoreThanOneSnapshotPerTestFileRun: false,
    addModifiedTestFileToExclusiveTestRun: true,
    preprocessors: { 'package.json': [Function (anonymous)] },
    maxConsoleMessagesPerTest: 100,
    autoConsoleLog: true,
    delays: { run: 0, edit: 100, update: 0 },
    workers: { initial: 0, regular: 0, recycle: false },
    teardown: undefined,
    hints: {
      ignoreCoverage: '__REGEXP /ignore coverage|istanbul ignore/',
      ignoreCoverageForFile: '__REGEXP /ignore file coverage/',
      commentAutoLog: '?',
      testFileSelection: { include: '__REGEXP /file\\.only/', exclude: '__REGEXP /file\\.skip/' }
    },
    automaticTestFileSelection: true,
    runSelectedTestsOnly: false,
    mapConsoleMessagesStackTrace: false,
    extensions: {},
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    loose: true,
    configCode: 'module.exports = function (w) {\n' +
      "  process.env.TZ = 'Europe/Paris';\n" +
      "  process.env.NODE_ENV = 'development';\n" +
      '\n' +
      '  return {\n' +
      '    files: [\n' +
      "      'packages/**/*.ts*',\n" +
      "      'packages/**/*.csv',\n" +
      "      'packages/**/*.json',\n" +
      "      'packages/*.js',\n" +
      "      '!packages/**/*.d.ts',\n" +
      "      '!packages/**/node_modules/**',\n" +
      "      '!packages/**/*spec.ts',\n" +
      "      '!packages/**/*spec.tsx',\n" +
      "      'packages/app/__mocks__/styleMock.js',\n" +
      '    ],\n' +
      '\n' +
      '    tests: [\n' +
      "      'packages/**/*spec.ts',\n" +
      "      'packages/**/*spec.tsx',\n" +
      "      '!packages/**/*slow.spec.ts',\n" +
      "      '!packages/**/*e2e.spec.ts',\n" +
      "      '!packages/**/node_modules/**',\n" +
      '    ],\n' +
      '\n' +
      '    compilers: {\n' +
      "      '**/*.ts?(x)': w.compilers.typeScript({\n" +
      '        isolatedModules: true,\n' +
      "        module: 'commonjs',\n" +
      "        jsx: 'react-jsx',\n" +
      "        target: 'es6', //defines what sort of code ts generates\n" +
      "        moduleResolution: 'node',\n" +
      '        sourceMap: true,\n' +
      '        emitDecoratorMetadata: true, //for angular to be able to use metadata we specify in our components.\n' +
      '        experimentalDecorators: true, //angular needs decorators like @Component, @Injectable, etc.\n' +
      '        removeComments: false,\n' +
      '        noImplicitAny: false,\n' +
      '        esModuleInterop: true,\n' +
      "        lib: ['es2016', 'dom', 'es5'],\n" +
      '      }),\n' +
      '    },\n' +
      '\n' +
      "    testFramework: 'jest',\n" +
      '\n' +
      '    env: {\n' +
      "      type: 'node',\n" +
      "      runner: 'node',\n" +
      '    },\n' +
      '\n' +
      '    setup: function (wallaby) {\n' +
      "      var path = require('path');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'node_modules');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'packages/luxon', 'node_modules');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'packages/common', 'node_modules');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'packages/api', 'node_modules');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'packages/app', 'node_modules');\n" +
      "      process.env.NODE_PATH += path.delimiter + path.join(wallaby.localProjectDir, 'packages/mail-sync', 'node_modules');\n" +
      '\n' +
      '      const jestConfig = {\n' +
      "        setupFiles: [path.join(wallaby.localProjectDir, 'packages/app', 'setup-jest.js')],\n" +
      "        testEnvironment: 'jsdom',\n" +
      "        setupFilesAfterEnv: ['@testing-library/jest-dom', 'luxon-jest-matchers', 'jest-extended'],\n" +
      "        moduleNameMapper: { '\\\\.(css|less|sass|scss|png)$': wallaby.projectCacheDir + '/packages/app/__mocks__/styleMock.js' },\n" +
      '        globals: { cometConfiguration: { ENV: process.env.ENV } },\n' +
      '      };\n' +
      '      wallaby.testFramework.configure(jestConfig);\n' +
      '    },\n' +
      '  };\n' +
      '};\n'
  },
  packageJSON: {
    dependencies: { 'jest-extended': '^0.11.5', lerna: '3.16.x', 'luxon-jest-matchers': '0.1.12', typescript: '4.3.x' },
    devDependencies: {
      '@types/jest': '26.0.x',
      '@types/luxon': '1.15.2',
      '@typescript-eslint/eslint-plugin': '^4.4.0',
      '@typescript-eslint/parser': '^4.4.0',
      concurrently: '5.3.0',
      eslint: '^7.11.0',
      'eslint-plugin-react': '^7.21.4',
      'eslint-plugin-react-hooks': '^4.1.2',
      husky: '^3.0.9',
      jest: '27.0.x',
      'lint-staged': '^10.5.2',
      prettier: '2.2.0',
      'ts-jest': '27.0.x'
    }
  },
  fs: { numberOfFiles: 743 },
  debug: [
    '2021-08-11T15:18:25.388Z project Wallaby Node version: v14.17.3\n',
    '2021-08-11T15:18:25.389Z project Wallaby config: <homeDir>/dev/comet/wallaby.js\n',
    '2021-08-11T15:18:26.999Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/projects/f5e6b2b5262c30e2\n',
    '2021-08-11T15:18:27.113Z uiService Listening port 51235\n',
    '2021-08-11T15:18:27.154Z project Config file change detected, invalidating local cache\n',
    '2021-08-11T15:18:27.253Z workers Parallelism for initial run: 10, for regular run: 5\n',
    '2021-08-11T15:18:27.253Z workers Starting run worker instance #0\n',
    '2021-08-11T15:18:27.253Z workers Starting run worker instance #1\n',
    '2021-08-11T15:18:27.253Z workers Starting run worker instance #2\n',
    '2021-08-11T15:18:27.253Z workers Starting run worker instance #3\n',
    '2021-08-11T15:18:27.253Z workers Starting run worker instance #4\n',
    '2021-08-11T15:18:27.254Z workers Starting run worker instance #5\n',
    '2021-08-11T15:18:27.254Z workers Starting run worker instance #6\n',
    '2021-08-11T15:18:27.254Z workers Starting run worker instance #7\n',
    '2021-08-11T15:18:27.254Z workers Starting run worker instance #8\n',
    '2021-08-11T15:18:27.254Z workers Starting run worker instance #9\n',
    '2021-08-11T15:18:27.254Z workers Web server is listening at 62199\n',
    '2021-08-11T15:18:27.254Z project File cache requires some updates, waiting required files from IDE\n',
    '2021-08-11T15:18:28.434Z workers Started run worker instance (delayed) #1\n',
    '2021-08-11T15:18:28.434Z workers Started run worker instance (delayed) #4\n',
    '2021-08-11T15:18:28.435Z workers Started run worker instance (delayed) #0\n',
    '2021-08-11T15:18:28.435Z workers Started run worker instance (delayed) #2\n',
    '2021-08-11T15:18:28.435Z workers Started run worker instance (delayed) #3\n',
    '2021-08-11T15:18:28.638Z workers Started run worker instance (delayed) #5\n',
    '2021-08-11T15:18:28.638Z workers Started run worker instance (delayed) #6\n',
    '2021-08-11T15:18:28.638Z workers Started run worker instance (delayed) #7\n',
    '2021-08-11T15:18:28.638Z workers Started run worker instance (delayed) #8\n',
    '2021-08-11T15:18:28.638Z workers Started run worker instance (delayed) #9\n',
    '2021-08-11T15:18:29.382Z project Compiler did not set ranges for file [packages/common/src/services-library/index.ts]\n',
    '2021-08-11T15:18:29.864Z project Compiler did not set ranges for file [packages/common/src/index.ts]\n',
    '2021-08-11T15:18:31.321Z project Compiler did not set ranges for file [packages/common/src/community/index.ts]\n',
    '2021-08-11T15:18:32.586Z project Compiler did not set ranges for file [packages/app/src/ui/helmet.tsx]\n',
    '2021-08-11T15:18:32.597Z project Compiler did not set ranges for file [packages/app/src/ui/paper-board.tsx]\n',
    '2021-08-11T15:18:32.603Z project Compiler did not set ranges for file [packages/app/src/ui/phone.tsx]\n',
    '2021-08-11T15:18:32.617Z project Compiler did not set ranges for file [packages/api/src/visits/visits.ts]\n',
    '2021-08-11T15:18:32.677Z project Compiler did not set ranges for file [packages/api/src/user/user-access.ts]\n',
    '2021-08-11T15:18:32.690Z project Compiler did not set ranges for file [packages/api/src/tracking/tracking.ts]\n',
    '2021-08-11T15:18:32.718Z project Compiler did not set ranges for file [packages/app/src/ui/typo/index.ts]\n',
    '2021-08-11T15:18:33.572Z project Compiler did not set ranges for file [packages/api/src/assistance/assistance.ts]\n',
    '2021-08-11T15:18:35.379Z project Compiler did not set ranges for file [packages/app/src/ops/room-agenda-model.ts]\n',
    '2021-08-11T15:18:35.719Z project Compiler did not set ranges for file [packages/app/src/conciergerie/conciergerie-model.ts]\n',
    '2021-08-11T15:18:37.499Z project Compiler did not set ranges for file [packages/common/src/booking/status.ts]\n',
    '2021-08-11T15:18:37.818Z project Compiler did not set ranges for file [packages/app/src/community/reporting/reporting-model.ts]\n',
    '2021-08-11T15:18:39.038Z project Compiler did not set ranges for file [packages/app/src/ipad/ui/typo/index.ts]\n',
    '2021-08-11T15:18:40.132Z project Re-attaching document block comment\n',
    '2021-08-11T15:18:40.242Z project Re-attaching document block comment\n',
    '2021-08-11T15:18:57.288Z project Re-attaching document block comment\n',
    '2021-08-11T15:18:57.371Z project Re-attaching document block comment\n',
    '2021-08-11T15:19:58.083Z project Stopping process pool\n',
    '2021-08-11T15:19:58.085Z project Test run started; run priority: 3\n',
    '2021-08-11T15:19:58.090Z project Running all tests\n',
    '2021-08-11T15:19:58.140Z workers Starting test run, priority: 3\n',
    '2021-08-11T15:19:58.140Z workers Distributing tests between 10 workers\n',
    '2021-08-11T15:19:58.172Z workers Running tests in parallel\n',
    '2021-08-11T15:19:58.174Z nodeRunner Starting sandbox [worker #0, session #k2abr]\n',
    '2021-08-11T15:19:58.174Z nodeRunner Starting sandbox [worker #1, session #dypok]\n',
    '2021-08-11T15:19:58.174Z nodeRunner Starting sandbox [worker #2, session #fv739]\n',
    '2021-08-11T15:19:58.175Z nodeRunner Starting sandbox [worker #3, session #vpph9]\n',
    '2021-08-11T15:19:58.175Z nodeRunner Starting sandbox [worker #4, session #u2hdj]\n',
    '2021-08-11T15:19:58.175Z nodeRunner Starting sandbox [worker #5, session #qqfe4]\n',
    '2021-08-11T15:19:58.175Z nodeRunner Starting sandbox [worker #6, session #tdl89]\n',
    '2021-08-11T15:19:58.176Z nodeRunner Starting sandbox [worker #7, session #stqof]\n',
    '2021-08-11T15:19:58.176Z nodeRunner Starting sandbox [worker #8, session #w2214]\n',
    '2021-08-11T15:19:58.176Z nodeRunner Starting sandbox [worker #9, session #lwmkz]\n',
    '2021-08-11T15:19:58.179Z nodeRunner Preparing sandbox [worker #0, session #k2abr]\n',
    '2021-08-11T15:19:58.179Z nodeRunner Preparing sandbox [worker #1, session #dypok]\n',
    '2021-08-11T15:19:58.179Z nodeRunner Preparing sandbox [worker #2, session #fv739]\n',
    '2021-08-11T15:19:58.179Z nodeRunner Preparing sandbox [worker #3, session #vpph9]\n',
    '2021-08-11T15:19:58.179Z nodeRunner Preparing sandbox [worker #4, session #u2hdj]\n',
    '2021-08-11T15:19:58.180Z nodeRunner Preparing sandbox [worker #5, session #qqfe4]\n',
    '2021-08-11T15:19:58.180Z nodeRunner Preparing sandbox [worker #6, session #tdl89]\n',
    '2021-08-11T15:19:58.180Z nodeRunner Preparing sandbox [worker #7, session #stqof]\n',
    '2021-08-11T15:19:58.181Z nodeRunner Preparing sandbox [worker #8, session #w2214]\n',
    '2021-08-11T15:19:58.181Z nodeRunner Preparing sandbox [worker #9, session #lwmkz]\n',
    '2021-08-11T15:19:58.181Z nodeRunner Prepared sandbox [worker #0, session #k2abr]\n',
    '2021-08-11T15:19:58.181Z nodeRunner Prepared sandbox [worker #1, session #dypok]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #2, session #fv739]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #3, session #vpph9]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #4, session #u2hdj]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #5, session #qqfe4]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #6, session #tdl89]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #7, session #stqof]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #8, session #w2214]\n',
    '2021-08-11T15:19:58.182Z nodeRunner Prepared sandbox [worker #9, session #lwmkz]\n',
    '2021-08-11T15:19:58.183Z workers [worker #0, session #k2abr] Running tests in sandbox\n',
    '2021-08-11T15:19:58.185Z workers [worker #1, session #dypok] Running tests in sandbox\n',
    '2021-08-11T15:19:58.186Z workers [worker #2, session #fv739] Running tests in sandbox\n',
    '2021-08-11T15:19:58.191Z workers [worker #3, session #vpph9] Running tests in sandbox\n',
    '2021-08-11T15:19:58.192Z workers [worker #4, session #u2hdj] Running tests in sandbox\n',
    '2021-08-11T15:19:58.193Z workers [worker #5, session #qqfe4] Running tests in sandbox\n',
    '2021-08-11T15:19:58.195Z workers [worker #6, session #tdl89] Running tests in sandbox\n',
    '2021-08-11T15:19:58.196Z workers [worker #7, session #stqof] Running tests in sandbox\n',
    '2021-08-11T15:19:58.197Z workers [worker #8, session #w2214] Running tests in sandbox\n',
    '2021-08-11T15:19:58.198Z workers [worker #9, session #lwmkz] Running tests in sandbox\n',
    '2021-08-11T15:19:58.232Z workers Sandbox (active) [k2abr] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.241Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.242Z workers Sandbox (active) [vpph9] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.243Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.243Z workers Sandbox (active) [fv739] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.250Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.250Z workers Sandbox (active) [u2hdj] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.250Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.251Z workers Sandbox (active) [dypok] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.251Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.251Z workers Sandbox (active) [qqfe4] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.252Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.252Z workers Sandbox (active) [tdl89] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.252Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.252Z workers Sandbox (active) [stqof] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.253Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.253Z workers Sandbox (active) [w2214] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.253Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.269Z workers Sandbox (active) [lwmkz] error: Failed to initialize wallaby jest.\nError: Cannot find Jest test runner\n',
    '2021-08-11T15:19:58.269Z workers Failed to map the stack to user code, entry message: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner, stack: Failed to initialize wallaby jest.\n' +
      'Error: Cannot find Jest test runner\n' +
      '    at Object.<anonymous> (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/runners/node/jest@0.4.3/initializer.js:14:8943)\n' +
      '    at Module._compile (internal/modules/cjs/loader.js:1085:14)\n' +
      '    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)\n' +
      '    at Module.load (internal/modules/cjs/loader.js:950:32)\n' +
      '    at Function.Module._load (internal/modules/cjs/loader.js:790:14)\n' +
      '    at Module.require (internal/modules/cjs/loader.js:974:19)\n' +
      '    at Module.r.require (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:29:23135)\n' +
      '    at require (internal/modules/cjs/helpers.js:92:18)\n' +
      '    at r (<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:114)\n' +
      '    at <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.302/wallaby9720a5/server.js:14:305\n' +
      '    at <homeDir>/.vscode/extensions\n',
    '2021-08-11T15:19:58.345Z workers [k2abr] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.345Z workers [vpph9] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.350Z workers [fv739] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.350Z workers [u2hdj] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.350Z workers [dypok] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.351Z workers [k2abr] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.352Z workers [vpph9] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.353Z workers [qqfe4] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.353Z workers [tdl89] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.353Z workers [stqof] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.354Z workers [w2214] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.359Z workers [fv739] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.362Z workers [u2hdj] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.362Z workers [dypok] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.362Z workers [tdl89] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.363Z workers [qqfe4] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.363Z workers [stqof] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.364Z workers [w2214] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.368Z workers [lwmkz] Run 0 test(s), skipped 0 test(s)\n',
    '2021-08-11T15:19:58.371Z workers [lwmkz] Sandbox is responsive, closing it\n',
    '2021-08-11T15:19:58.371Z workers Merging parallel test run results\n',
    '2021-08-11T15:19:58.372Z project Test run finished\n',
    '2021-08-11T15:19:58.372Z project Processed console.log entries\n',
    '2021-08-11T15:19:58.372Z project Processed loading sequences\n',
    '2021-08-11T15:19:58.372Z project Processed executed tests\n',
    '2021-08-11T15:19:58.446Z project Processed code coverage\n',
    '2021-08-11T15:19:58.675Z project Test run result processed and sent to IDE\n'
  ]
}
smcenlly commented 3 years ago

Thanks for providing your Wallaby diagnostics report. We can see that you have manually configured Wallaby to use our older version of jest integration.

Since late 2019, starting from jest v24, a configuration file is no longer required to start using Wallaby with jest. Specifying a manual jest configuration is no longer supported from jest v27. Please switch to use automatic configuration, it should work for you.

If you're having problems with automatic configuration, please let us know.

alexvictoor commented 3 years ago

Thank @smcenlly for your response. I work with @abalhier on the same project. We have succeed to have wallaby partially working using automatic configuration. Our project is a mono repo, managed by lerna, with nodejs modules and reactjs browser modules. Our tests need some setup and hence we moved what we had before in our wallabyjs conf file into a jest config file on top of our mono repo.

The first issue we ran into is that jest config files in our sub modules are not used by wallaby. Since we have nodejs code and reactjs code, some tests need jsdom test environment whereas other need node test environment.

When we focus on reactjs tests, using jsdomtest environment, we have some weird errors "ReferenceError: React is not defined" on tsx files where React is not imported (no problem at runtime with those files since we use reactjs v17...).

Thanks for your help

smcenlly commented 3 years ago

@alexvictoor - does jest work for you when running from the mono repo root (outside of wallaby)?

alexvictoor commented 3 years ago

@smcenlly I get the same issue with react files. I guess only the jest config file located at the mono repo root is taken into account. Maybe the behaviour changed between jest26 and jest27. Would it be possible for wallaby to take into account jest config files located in sub modules?

smcenlly commented 3 years ago

I get the same issue with react files

I assume you are saying that you get the same problem outside of Wallaby when using jest?

Would it be possible for wallaby to take into account jest config files located in sub modules?

Wallaby can use the jest config files located in sub modules if you specify to run a single project using the VS Code command, Wallaby.js: Select Configuration and then select Automatic Configuration <custom directory>....


If you already have a jest configuration in your mono-repo root and it is no longer working for you, we suggest that you update it to run all of your projects, and then Wallaby should also work (i.e. fix jest to run from the CLI and then start Wallaby).

If you have an existing jest configuration that you want to be separate to running the sub-projects, then you may create another jest configuration, e.g. jest.config.wallaby.js and manually specify for Wallaby to use that configuration instead with a Wallaby configuration file:

wallaby.js

module.exports = () => {
  return {
    // tell wallaby to use automatic configuration
    autoDetect: true,

    testFramework: {
      // the jest configuration file path
      // (relative to project root)
      configFile: './jest.config.wallaby.js'
    }
  }
};

You should be able to create a jest.config.js in your mono-repo root that includes all of the sub-projects:

jest.config.js

module.exports = {
    projects: [
        '<rootDir>/api/',
        '<rootDir>/web/',
        '<rootDir>/mobile/',
    ],
}
smcenlly commented 3 years ago

I'm assuming that my last reply helped you get things working and am closing the issue. If you're still having problems, please reply with more detail and we will reopen.

abalhier commented 3 years ago

Thanks it helped fix our problem !