wallabyjs / public

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

vitest webworker code is not instrumented #3316

Closed inverted-capital closed 10 months ago

inverted-capital commented 10 months ago

I have a file https://github.com/dreamcatcher-tech/artifact/blob/main/src/exec/io.fixture.js that is loaded as a webworker or nodeworker in this place: https://github.com/dreamcatcher-tech/artifact/blob/19862cf837338d12105aa07dd405a8cf0e2f7021/src/exec/io.js#L57C35-L57C35

The problem is that the webworker code is not instrumented by wallaby and does not show the gutter feedback. If I put a debugger breakpoint in for the vscode debugger it will stop in this file, but wallaby seems to ignore it. How can I get the visual feedback from wallaby that I need ?

Wallaby diagnostics report

{
  editorVersion: '1.85.1',
  pluginVersion: '1.0.371',
  editorType: 'VSCode',
  osVersion: 'linux 6.2.7-100.fc36.x86_64',
  nodeVersion: 'v21.0.0',
  coreVersion: '1.0.1517',
  checksum: 'N2M3ZGU1MzBhMjg0Njk1YThiOWZiZWU5YWE0NzcyY2MsMTcwODQ3MzYwMDAwMCww',
  config: {
    runners: { restart: true },
    env: {
      type: 'node',
      params: {},
      runner: '<homeDir>/.local/share/fnm/node-versions/v21.0.0/installation/bin/node',
      viewportSize: { width: 800, height: 600 },
      options: { width: 800, height: 600 },
      bundle: true
    },
    diagnostics: {
      vitest: {
        file: {
          config: "import { defineConfig } from 'vite'\n" +
            "import react from '@vitejs/plugin-react-swc'\n" +
            '\n' +
            '// https://vitejs.dev/config/\n' +
            'export default defineConfig({\n' +
            '  plugins: [react()],\n' +
            '  test: {\n' +
            "    setupFiles: ['fake-indexeddb/auto'],\n" +
            '  },\n' +
            '})\n'
        },
        config: {
          config: {
            allowOnly: true,
            isolate: true,
            watch: true,
            globals: false,
            environment: 'node',
            pool: 'threads',
            clearMocks: false,
            restoreMocks: false,
            mockReset: false,
            include: [ '**/*.{test,spec}.?(c|m)[jt]s?(x)' ],
            exclude: [
              '**/node_modules/**',
              '**/dist/**',
              '**/cypress/**',
              '**/.{idea,git,cache,output,temp}/**',
              '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*'
            ],
            testTimeout: 5000,
            hookTimeout: 10000,
            teardownTimeout: 10000,
            watchExclude: [ '**/node_modules/**', '**/dist/**' ],
            forceRerunTriggers: [ '**/package.json/**', '**/{vitest,vite}.config.*/**', '<homeDir>/repos/artifact/node_modules/fake-indexeddb/auto/index.mjs' ],
            update: false,
            reporters: [ 'default' ],
            silent: false,
            hideSkippedTests: false,
            api: { middlewareMode: true },
            ui: false,
            uiBase: '/__vitest__/',
            open: true,
            css: { include: [], modules: { classNameStrategy: 'stable' } },
            coverage: {
              provider: 'v8',
              enabled: false,
              all: true,
              clean: true,
              cleanOnRerun: true,
              reportsDirectory: './coverage',
              exclude: [
                'coverage/**',
                'dist/**',
                '**/[.]**',
                'packages/*/test?(s)/**',
                '**/*.d.ts',
                '**/virtual:*',
                '**/__x00__*',
                '**/\x00*',
                'cypress/**',
                'test?(s)/**',
                'test?(-*).?(c|m)[jt]s?(x)',
                '**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)',
                '**/__tests__/**',
                '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
                '**/vitest.{workspace,projects}.[jt]s?(on)',
                '**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}',
                'node_modules/fake-indexeddb/auto/index.mjs'
              ],
              reportOnFailure: false,
              reporter: [ [ 'text', {} ], [ 'html', {} ], [ 'clover', {} ], [ 'json', {} ] ],
              extension: [
                '.js',    '.cjs',
                '.mjs',   '.ts',
                '.mts',   '.cts',
                '.tsx',   '.jsx',
                '.vue',   '.svelte',
                '.marko'
              ],
              allowExternal: false,
              processingConcurrency: 16
            },
            fakeTimers: { loopLimit: 10000, shouldClearNativeTimers: true, toFake: [ 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate', 'Date' ] },
            maxConcurrency: 5,
            dangerouslyIgnoreUnhandledErrors: false,
            typecheck: {
              checker: 'tsc',
              include: [ '**/*.{test,spec}-d.?(c|m)[jt]s?(x)' ],
              exclude: [
                '**/node_modules/**',
                '**/dist/**',
                '**/cypress/**',
                '**/.{idea,git,cache,output,temp}/**',
                '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*'
              ],
              enabled: false
            },
            slowTestThreshold: 300,
            setupFiles: [ '<homeDir>/repos/artifact/node_modules/fake-indexeddb/auto/index.mjs' ],
            poolOptions: { threads: {}, forks: {} },
            config: '<homeDir>/repos/artifact/vite.config.js',
            defines: {},
            root: '<homeDir>/repos/artifact',
            mode: [],
            inspect: false,
            inspectBrk: false,
            fileParallelism: true,
            deps: {
              moduleDirectories: [ '/node_modules/' ],
              optimizer: { ssr: { enabled: true }, web: { enabled: true } },
              web: { transformAssets: true, transformCss: true, transformGlobPattern: [] }
            },
            server: { deps: { inline: [ {}, {}, {}, '@nuxt/test-utils' ], moduleDirectories: [ '/node_modules/' ], cacheDir: 'node_modules/.vitest' } },
            snapshotOptions: { expand: false, snapshotFormat: {}, updateSnapshot: 'new', snapshotEnvironment: null },
            poolMatchGlobs: [],
            globalSetup: [],
            cache: { dir: '<homeDir>/repos/artifact/node_modules/.vitest' },
            sequence: { hooks: 'parallel' },
            environmentMatchGlobs: [],
            browser: { enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
            testTransformMode: {}
          },
          projects: [
            {
              path: '<homeDir>/repos/artifact',
              config: {
                allowOnly: true,
                isolate: true,
                watch: true,
                globals: false,
                environment: 'node',
                pool: 'threads',
                clearMocks: false,
                restoreMocks: false,
                mockReset: false,
                include: [ '**/*.{test,spec}.?(c|m)[jt]s?(x)' ],
                exclude: [
                  '**/node_modules/**',
                  '**/dist/**',
                  '**/cypress/**',
                  '**/.{idea,git,cache,output,temp}/**',
                  '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*'
                ],
                testTimeout: 5000,
                hookTimeout: 10000,
                teardownTimeout: 10000,
                watchExclude: [ '**/node_modules/**', '**/dist/**' ],
                forceRerunTriggers: [ '**/package.json/**', '**/{vitest,vite}.config.*/**', '<homeDir>/repos/artifact/node_modules/fake-indexeddb/auto/index.mjs' ],
                update: false,
                reporters: [ 'default' ],
                silent: false,
                hideSkippedTests: false,
                api: { middlewareMode: true },
                ui: false,
                uiBase: '/__vitest__/',
                open: true,
                css: { include: [], modules: { classNameStrategy: 'stable' } },
                coverage: {
                  provider: 'v8',
                  enabled: false,
                  all: true,
                  clean: true,
                  cleanOnRerun: true,
                  reportsDirectory: './coverage',
                  exclude: [
                    'coverage/**',
                    'dist/**',
                    '**/[.]**',
                    'packages/*/test?(s)/**',
                    '**/*.d.ts',
                    '**/virtual:*',
                    '**/__x00__*',
                    '**/\x00*',
                    'cypress/**',
                    'test?(s)/**',
                    'test?(-*).?(c|m)[jt]s?(x)',
                    '**/*{.,-}{test,spec}.?(c|m)[jt]s?(x)',
                    '**/__tests__/**',
                    '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
                    '**/vitest.{workspace,projects}.[jt]s?(on)',
                    '**/.{eslint,mocha,prettier}rc.{?(c|m)js,yml}',
                    'node_modules/fake-indexeddb/auto/index.mjs'
                  ],
                  reportOnFailure: false,
                  reporter: [ [ 'text', {} ], [ 'html', {} ], [ 'clover', {} ], [ 'json', {} ] ],
                  extension: [
                    '.js',    '.cjs',
                    '.mjs',   '.ts',
                    '.mts',   '.cts',
                    '.tsx',   '.jsx',
                    '.vue',   '.svelte',
                    '.marko'
                  ],
                  allowExternal: false,
                  processingConcurrency: 16
                },
                fakeTimers: { loopLimit: 10000, shouldClearNativeTimers: true, toFake: [ 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate', 'Date' ] },
                maxConcurrency: 5,
                dangerouslyIgnoreUnhandledErrors: false,
                typecheck: {
                  checker: 'tsc',
                  include: [ '**/*.{test,spec}-d.?(c|m)[jt]s?(x)' ],
                  exclude: [
                    '**/node_modules/**',
                    '**/dist/**',
                    '**/cypress/**',
                    '**/.{idea,git,cache,output,temp}/**',
                    '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*'
                  ],
                  enabled: false
                },
                slowTestThreshold: 300,
                setupFiles: [ '<homeDir>/repos/artifact/node_modules/fake-indexeddb/auto/index.mjs' ],
                poolOptions: { threads: {}, forks: {} },
                config: '<homeDir>/repos/artifact/vite.config.js',
                defines: {},
                root: '<homeDir>/repos/artifact',
                mode: [],
                inspect: false,
                inspectBrk: false,
                fileParallelism: true,
                deps: {
                  moduleDirectories: [ '/node_modules/' ],
                  optimizer: { ssr: { enabled: true }, web: { enabled: true } },
                  web: { transformAssets: true, transformCss: true, transformGlobPattern: [] }
                },
                server: { deps: { inline: [ {}, {}, {}, '@nuxt/test-utils' ], moduleDirectories: [ '/node_modules/' ], cacheDir: 'node_modules/.vitest' } },
                snapshotOptions: { expand: false, snapshotFormat: {}, updateSnapshot: 'new', snapshotEnvironment: null },
                poolMatchGlobs: [],
                globalSetup: [],
                cache: { dir: '<homeDir>/repos/artifact/node_modules/.vitest' },
                sequence: { hooks: 'parallel' },
                environmentMatchGlobs: [],
                browser: { enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
                testTransformMode: {}
              }
            }
          ],
          package: {
            version: '1.1.3',
            urls: { hooks: 'file://<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/runners/node/hooks.mjs' },
            paths: { root: '<homeDir>/repos/artifact/node_modules/vitest', dist: '<homeDir>/repos/artifact/node_modules/vitest/dist' }
          }
        }
      }
    },
    testFramework: { version: 'vitest@0.14.0', configurator: 'vitest@0.14.0', reporter: 'vitest@0.14.0', starter: 'vitest@0.14.0', autoDetected: true },
    preserveComments: false,
    extractComments: true,
    files: [
      { pattern: '**/*.{test,spec}.?(c|m)[jt]s?(x)', ignore: true, trigger: true, load: true, file: true },
      { pattern: '**/node_modules/**', ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/dist/**', ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/cypress/**', ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/.{idea,git,cache,output,temp}/**', ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*', ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/*.*', ignore: false, trigger: true, load: true, order: 1 }
    ],
    tests: [
      { pattern: '**/node_modules/**', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/dist/**', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/cypress/**', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/.{idea,git,cache,output,temp}/**', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build,eslint,prettier}.config.*', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/*.{test,spec}.?(c|m)[jt]s?(x)', ignore: false, trigger: true, load: true, test: true, order: 2 }
    ],
    workers: { initial: 1, regular: 1, recycle: false },
    dot: true,
    captureConsoleLog: true,
    filesWithNoCoverageCalculated: [],
    runAllTestsInAffectedTestFile: false,
    updateNoMoreThanOneSnapshotPerTestFileRun: false,
    compilers: {},
    logLimits: { inline: { depth: 5, elements: 5000 }, values: { default: { stringLength: 200 }, autoExpand: { elements: 5000, stringLength: 8192, depth: 10 } } },
    preprocessors: {},
    maxConsoleMessagesPerTest: 100,
    autoConsoleLog: true,
    delays: { run: 0, edit: 100, update: 0 },
    teardown: undefined,
    hints: {
      ignoreCoverage: '__REGEXP /ignore coverage|istanbul ignore|c8 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,
    runAllTestsWhenNoAffectedTests: true,
    symlinkNodeModules: true,
    configCode: 'auto.detect#-869259263'
  },
  packageJSON: {
    dependencies: {
      '@emotion/react': '^11.11.3',
      '@emotion/styled': '^11.11.0',
      '@isomorphic-git/lightning-fs': '^4.6.0',
      '@mui/icons-material': '5.15.3',
      '@mui/lab': '^5.0.0-alpha.159',
      '@mui/material': '5.15.3',
      ajv: '^8.12.0',
      'assert-fast': '^1.0.3',
      buffer: '^6.0.3',
      debug: '^4.3.4',
      'isomorphic-git': '^1.25.3',
      'lodash.merge': '^4.6.2',
      openai: '^4.24.2',
      'patch-package': '^8.0.0',
      'path-browserify': '^1.0.1',
      react: '^18.2.0',
      'react-audio-visualize': '^1.1.3',
      'react-audio-voice-recorder': '^2.2.0',
      'react-dom': '^18.2.0',
      'react-inspector': '^6.0.2',
      'react-markdown': '^9.0.1',
      'remark-gfm': '^4.0.0',
      'serialize-error': '^11.0.3',
      threads: '^1.7.0',
      uint8arrays: '^5.0.1',
      'use-file-picker': '^2.1.1',
      wherearewe: '^2.0.1'
    },
    devDependencies: {
      '@storybook/addon-essentials': '^7.6.7',
      '@storybook/addon-interactions': '^7.6.7',
      '@storybook/addon-links': '^7.6.7',
      '@storybook/blocks': '^7.6.7',
      '@storybook/react': '^7.6.7',
      '@storybook/react-vite': '^7.6.7',
      '@storybook/test': '^7.6.7',
      '@types/react': '^18.2.47',
      '@types/react-dom': '^18.2.18',
      '@vitejs/plugin-react-swc': '^3.5.0',
      chromatic: '^10.2.0',
      dotenv: '^16.3.1',
      eslint: '^8.56.0',
      'eslint-plugin-react': '^7.33.2',
      'eslint-plugin-react-hooks': '^4.6.0',
      'eslint-plugin-react-refresh': '^0.4.5',
      'eslint-plugin-storybook': '^0.6.15',
      'fake-indexeddb': '^5.0.2',
      'prop-types': '^15.8.1',
      storybook: '^7.6.7',
      vite: '^5.0.11',
      vitest: '^1.1.3'
    }
  },
  fs: { numberOfFiles: 69 },
  debug: [
    '2024-01-09T23:16:24.526Z project waiting for initial run signal\n',
    '2024-01-09T23:16:24.534Z config Attempting automatic configuration for angular\n',
    '2024-01-09T23:16:24.537Z angular/cli config Angular CLI not found.\n',
    '2024-01-09T23:16:24.537Z config Finished attempting automatic configuration for angular (3ms)\n',
    '2024-01-09T23:16:24.538Z config Attempting automatic configuration for jest\n',
    "2024-01-09T23:16:24.539Z jest/config Error: Module jest-cli is not found in '<homeDir>/repos/artifact'.\n" +
      '    at Object.loadJest (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:508:1070)\n' +
      '    at n (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:196:24440)\n' +
      '    at r.configure (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:196:27605)\n' +
      '    at automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:144:12259)\n' +
      '    at async automaticConfigurationProviders.reduce.Promise.resolve.success (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:144:12136)\n' +
      '    at async Config.load (<homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyfe9ea4/server.js:144:12076)\n',
    '2024-01-09T23:16:24.539Z config Finished attempting automatic configuration for jest (1ms)\n',
    '2024-01-09T23:16:24.539Z config Attempting automatic configuration for vitest\n',
    '2024-01-09T23:16:24.541Z vitest/config Detected Vitest (1.1.3).\n',
    '2024-01-09T23:16:25.036Z config Finished attempting automatic configuration for vitest (497ms)\n',
    '2024-01-09T23:16:25.037Z project Wallaby Node version: v21.0.0\n',
    '2024-01-09T23:16:25.037Z project Wallaby config: <homeDir>/repos/artifact/auto.detect\n',
    '2024-01-09T23:16:25.089Z fs File system starting\n',
    '2024-01-09T23:16:25.134Z fs File system scan completed\n',
    '2024-01-09T23:16:25.139Z project File cache: <homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.371/projects/6fd723bb7dc74284_1\n',
    '2024-01-09T23:16:25.144Z uiService Listening port 51236\n',
    '2024-01-09T23:16:25.149Z project package.json file change detected, invalidating local cache\n',
    '2024-01-09T23:16:25.157Z workers Parallelism for initial run: 1, for regular run: 1\n',
    '2024-01-09T23:16:25.157Z workers Starting run worker instance #0\n',
    '2024-01-09T23:16:25.158Z workers Web server is listening at 44895\n',
    '2024-01-09T23:16:25.158Z project File cache requires some updates, waiting required files from IDE\n',
    '2024-01-09T23:16:25.162Z fs File changed in editor: src/exec/runner.js\n',
    '2024-01-09T23:16:25.242Z project Stopping process pool\n',
    '2024-01-09T23:16:25.244Z project Promoting test run to full run because of test selection changes\n',
    '2024-01-09T23:16:25.244Z project Test run started; run priority: 3\n',
    '2024-01-09T23:16:25.245Z project Running all tests\n',
    '2024-01-09T23:16:25.246Z workers Starting test run, priority: 3\n',
    '2024-01-09T23:16:25.247Z nodeRunner Starting sandbox [worker #0, session #z1i7v]\n',
    '2024-01-09T23:16:25.247Z nodeRunner Preparing sandbox [worker #0, session #z1i7v]\n',
    '2024-01-09T23:16:25.284Z workers Started run worker instance (delayed) #0\n',
    '2024-01-09T23:16:25.284Z nodeRunner Prepared sandbox [worker #0, session #z1i7v]\n',
    '2024-01-09T23:16:25.284Z workers [worker #0, session #z1i7v] Running tests in sandbox\n',
    "2024-01-09T23:16:25.691Z workers 'Scheduling Vitest Run (z1i7v): 2024-01-09T23:16:25.671Z'\n",
    '2024-01-09T23:16:26.690Z workers [z1i7v.1] Loaded unknown number of test(s)\n',
    '2024-01-09T23:16:26.893Z workers [z1i7v.1] Test executed: ping\n',
    "2024-01-09T23:16:26.946Z workers 'Vitest Run Complete (z1i7v): 2024-01-09T23:16:26.929Z'\n",
    '2024-01-09T23:16:26.946Z workers [z1i7v] Run 1 test(s), skipped 0 test(s)\n',
    '2024-01-09T23:16:26.948Z workers [z1i7v] Sandbox is responsive, closing it\n',
    '2024-01-09T23:16:26.949Z project Test run finished\n',
    '2024-01-09T23:16:26.950Z project Processed console.log entries\n',
    '2024-01-09T23:16:26.950Z project Processed loading sequences\n',
    '2024-01-09T23:16:26.950Z project Processed executed tests\n',
    '2024-01-09T23:16:26.953Z project Processed code coverage\n',
    '2024-01-09T23:16:26.983Z project Test run result processed and sent to IDE\n',
    '2024-01-09T23:18:38.811Z fs File deleted: src/exec/runner.js\n',
    '2024-01-09T23:18:38.816Z project Test run started; run priority: 2\n',
    '2024-01-09T23:18:38.816Z testTask Test files from affected: 0, from deleted or manually requested: 1, from recently changed: 0, from loaded by: 0, from failing: 1\n',
    '2024-01-09T23:18:38.816Z testTask Running only selected or not excluded tests\n',
    '2024-01-09T23:18:38.817Z workers Starting test run, priority: 2\n',
    '2024-01-09T23:18:38.817Z nodeRunner Starting sandbox [worker #0, session #eog5x]\n',
    '2024-01-09T23:18:38.817Z nodeRunner Preparing sandbox [worker #0, session #eog5x]\n',
    '2024-01-09T23:18:38.817Z nodeRunner Prepared sandbox [worker #0, session #eog5x]\n',
    '2024-01-09T23:18:38.817Z workers [worker #0, session #eog5x] Running tests in sandbox\n',
    "2024-01-09T23:18:38.820Z workers 'Scheduling Vitest Run (eog5x): 2024-01-09T23:18:38.819Z'\n",
    '2024-01-09T23:18:38.999Z workers Sandbox (active) [eog5x] error: Failed to load url /src/exec/runner.js (resolved id: ./src/exec/runner.js) in ./src/exec/artifact.js. Does the file exist?\n' +
      '    at loadAndTransform (file://./node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:49731:21)\n' +
      '    at async ViteNodeServer._wallabyTransformRequest (file://./node_modules/vite-node/dist/server.mjs:393:16)\n' +
      '    at async ViteNodeServer._transformRequest (file://./node_modules/vite-node/dist/server.mjs:379:141)\n' +
      '    at async ViteNodeServer._fetchModule (file://./node_modules/vite-node/dist/server.mjs:359:17)\n',
    '2024-01-09T23:18:39.000Z workers [eog5x.1] Loaded unknown number of test(s)\n',
    "2024-01-09T23:18:39.014Z workers 'Vitest Run Complete (eog5x): 2024-01-09T23:18:39.010Z'\n",
    '2024-01-09T23:18:39.015Z workers [eog5x] Run 0 test(s), skipped 0 test(s)\n',
    '2024-01-09T23:18:39.016Z workers [eog5x] Sandbox is responsive, closing it\n',
    '2024-01-09T23:18:39.016Z workers Failed to map the stack to user code, entry message: Error: Failed to load url /src/exec/runner.js (resolved id: <homeDir>/repos/artifact/src/exec/runner.js) in <homeDir>/repos/artifact/src/exec/artifact.js. Does the file exist?, stack: Error: Failed to load url /src/exec/runner.js (resolved id: <homeDir>/repos/artifact/src/exec/runner.js) in <homeDir>/repos/artifact/src/exec/artifact.js. Does the file exist?\n' +
      '    at loadAndTransform (file://<homeDir>/repos/artifact/node_modules/vite/dist/node/chunks/dep-V3BH7oO1.js:49731:21)\n' +
      '    at async ViteNodeServer._wallabyTransformRequest (file://<homeDir>/repos/artifact/node_modules/vite-node/dist/server.mjs:393:16)\n' +
      '    at async ViteNodeServer._transformRequest (file://<homeDir>/repos/artifact/node_modules/vite-node/dist/server.mjs:379:141)\n' +
      '    at async ViteNodeServer._fetchModule (file://<homeDir>/repos/artifact/node_modules/vite-node/dist/server.mjs:359:17)\n',
    '2024-01-09T23:18:39.017Z project Test run finished\n',
    '2024-01-09T23:18:39.017Z project Processed console.log entries\n',
    '2024-01-09T23:18:39.017Z project Processed loading sequences\n',
    '2024-01-09T23:18:39.017Z project Processed executed tests\n',
    '2024-01-09T23:18:39.017Z project Processed code coverage\n',
    '2024-01-09T23:18:39.019Z project Test run result processed and sent to IDE\n',
    '2024-01-09T23:18:39.022Z project Test run started; run priority: 2\n',
    '2024-01-09T23:18:39.023Z testTask Test files from affected: 0, from deleted or manually requested: 0, from recently changed: 0, from loaded by: 0, from failing: 0\n',
    '2024-01-09T23:18:39.023Z testTask Running only selected or not excluded tests\n',
    '2024-01-09T23:18:39.024Z project Test run finished\n',
    '2024-01-09T23:18:39.024Z project Test run data re-queued\n',
    '2024-01-09T23:18:54.691Z fs File changed in editor: src/exec/artifact.js\n',
    '2024-01-09T23:18:54.698Z project Test run started; run priority: 2\n',
    '2024-01-09T23:18:54.698Z testTask Test files from affected: 1, from deleted or manually requested: 0, from recently changed: 0, from loaded by: 0, from failing: 0\n',
    '2024-01-09T23:18:54.698Z testTask Running only selected or not excluded tests\n',
    '2024-01-09T23:18:54.699Z workers Starting test run, priority: 2\n',
    '2024-01-09T23:18:54.699Z nodeRunner Starting sandbox [worker #0, session #ks2qb]\n',
    '2024-01-09T23:18:54.699Z nodeRunner Preparing sandbox [worker #0, session #ks2qb]\n',
    '2024-01-09T23:18:54.699Z nodeRunner Prepared sandbox [worker #0, session #ks2qb]\n',
    '2024-01-09T23:18:54.699Z workers [worker #0, session #ks2qb] Running tests in sandbox\n',
    "2024-01-09T23:18:54.704Z workers 'Scheduling Vitest Run (ks2qb): 2024-01-09T23:18:54.701Z'\n",
    '2024-01-09T23:18:55.127Z workers [ks2qb.1] Loaded unknown number of test(s)\n',
    '2024-01-09T23:18:55.317Z workers [ks2qb.1] Test executed: ping\n',
    "2024-01-09T23:18:55.338Z workers 'Vitest Run Complete (ks2qb): 2024-01-09T23:18:55.334Z'\n",
    '2024-01-09T23:18:55.340Z workers [ks2qb] Run 1 test(s), skipped 0 test(s)\n',
    '2024-01-09T23:18:55.341Z workers [ks2qb] Sandbox is responsive, closing it\n',
    '2024-01-09T23:18:55.341Z project Test run finished\n',
    '2024-01-09T23:18:55.341Z project Processed console.log entries\n',
    '2024-01-09T23:18:55.341Z project Processed loading sequences\n',
    '2024-01-09T23:18:55.341Z project Processed executed tests\n',
    '2024-01-09T23:18:55.342Z project Processed code coverage\n',
    '2024-01-09T23:18:55.348Z project Test run result processed and sent to IDE\n',
    '2024-01-09T23:19:01.997Z fs File changed in editor: src/exec/artifact.js\n',
    '2024-01-09T23:19:02.002Z project Test run started; run priority: 2\n',
    '2024-01-09T23:19:02.002Z testTask Test files from affected: 1, from deleted or manually requested: 0, from recently changed: 0, from loaded by: 0, from failing: 1\n',
    '2024-01-09T23:19:02.002Z testTask Running only selected or not excluded tests\n',
    '2024-01-09T23:19:02.003Z workers Starting test run, priority: 2\n',
    '2024-01-09T23:19:02.004Z nodeRunner Starting sandbox [worker #0, session #h9y7q]\n',
    '2024-01-09T23:19:02.004Z nodeRunner Preparing sandbox [worker #0, session #h9y7q]\n',
    '2024-01-09T23:19:02.004Z nodeRunner Prepared sandbox [worker #0, session #h9y7q]\n',
    '2024-01-09T23:19:02.004Z workers [worker #0, session #h9y7q] Running tests in sandbox\n',
    "2024-01-09T23:19:02.008Z workers 'Scheduling Vitest Run (h9y7q): 2024-01-09T23:19:02.006Z'\n",
    '2024-01-09T23:19:02.393Z workers [h9y7q.1] Loaded unknown number of test(s)\n',
    '2024-01-09T23:19:02.591Z workers [h9y7q.1] Test executed: ping\n',
    "2024-01-09T23:19:02.622Z workers 'Vitest Run Complete (h9y7q): 2024-01-09T23:19:02.619Z'\n",
    '2024-01-09T23:19:02.623Z workers [h9y7q] Run 1 test(s), skipped 0 test(s)\n',
    '2024-01-09T23:19:02.624Z workers [h9y7q] Sandbox is responsive, closing it\n',
    '2024-01-09T23:19:02.624Z project Test run finished\n',
    '2024-01-09T23:19:02.624Z project Processed console.log entries\n',
    '2024-01-09T23:19:02.624Z project Processed loading sequences\n',
    '2024-01-09T23:19:02.624Z project Processed executed tests\n',
    '2024-01-09T23:19:02.625Z project Processed code coverage\n',
    '2024-01-09T23:19:02.630Z project Test run result processed and sent to IDE\n',
    '2024-01-09T23:19:16.119Z fs File changed: src/exec/artifact.js\n',
    '2024-01-09T23:19:16.120Z fs No changes detected for src/exec/artifact.js\n',
    '2024-01-09T23:19:16.120Z extended-core File was not changed, but file markers may need to be synced\n'
  ]
}
smcenlly commented 10 months ago

The behavior that you're seeing is a byproduct of what your test is doing and is not really related to Wallaby per se. What you are seeing is a result of how vitest is executing your tests.

You can reproduce similar behavior / issues in vitest:

  1. Start vitest in watch mode (npm run test for your project), and change io.fixture.js to return something other than return 'local reply'; you will see that your test doesn't automatically re-execute as vitest doesn't know about the relationship between your code and your test because of the web worker.

  2. Configure vitest to report on code coverage (instead of using Wallaby), and you will see that vitest thinks that io.fixture.js is never executed:

vitest.config.js

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  test: {
    setupFiles: ['fake-indexeddb/auto'],
    testTimeout: 500,
    include: ['src/exec/io.test.js'],
    coverage: {
      enabled: true,
      provider: 'v8',
    },
  },
})

At the moment, when you use expose to run in the worker thread, you're effectively bypassing vitest's execution pipeline (and also Wallaby's functionality).

In order for Wallaby to support your scenario, it would first need to be supported by vitest itself. I'm not sure how feasible this is, but recommend you raise a feature request with them. If vitest supports your scenario then it's possible Wallaby will simply work for you without us needing to do anything special.

inverted-capital commented 10 months ago

thank you !!