wallabyjs / public

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

TypeScript transpilation errors with vitest and unplugin-swc #3391

Closed glitch452 closed 2 months ago

glitch452 commented 2 months ago

Issue description or question

When Vitest is configured with unplugin-swc, Wallaby is unable to transpile TypeScript.

This issue has been previously reported as:

The issue was previously fixed, and it works with unplugin-swc up to 1.4.5, but when updating to 1.5.1 this issue seems to come up again.

I forked and updated the versions in the previous minimal sample repo: https://github.com/glitch452/nestjs-vitest

Running npm test is able to execute the tests successfully, but the wallaby start fails.

Wallaby diagnostics report

{
  editorVersion: '1.92.0',
  pluginVersion: '1.0.381',
  editorType: 'VSCode',
  osVersion: 'darwin 23.5.0',
  nodeVersion: 'v20.15.1',
  coreVersion: '1.0.1591',
  pnp: '<not set>',
  pnpEsm: '<not set>',
  checksum: 'ZDhlOTk3OWY5ZjA4YTE3ODlhMmQwNzRkYjM0NjAyNDYsMTc0NjkyMTYwMDAwMCww',
  config: {
    diagnostics: {
      vitest: {
        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.*/**' ],
            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}?(-d).?(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}'
              ],
              reportOnFailure: false,
              reporter: [ [ 'text', {} ], [ 'html', {} ], [ 'clover', {} ], [ 'json', {} ] ],
              extension: [
                '.js',    '.cjs',
                '.mjs',   '.ts',
                '.mts',   '.cts',
                '.tsx',   '.jsx',
                '.vue',   '.svelte',
                '.marko'
              ],
              allowExternal: false,
              ignoreEmptyLines: false,
              processingConcurrency: 12
            },
            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,
            disableConsoleIntercept: false,
            poolOptions: { threads: {}, forks: {} },
            config: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/vitest.config.mts',
            defines: {},
            root: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest',
            mode: 'test',
            inspector: { enabled: false, waitForDebugger: false },
            clearScreen: true,
            browser: { fileParallelism: false, enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
            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/.vite' } },
            snapshotOptions: { expand: false, snapshotFormat: {}, updateSnapshot: 'new', snapshotEnvironment: null },
            snapshotSerializers: [],
            poolMatchGlobs: [],
            setupFiles: [],
            globalSetup: [],
            cache: { dir: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/node_modules/.vite/vitest' },
            sequence: { hooks: 'parallel' },
            environmentMatchGlobs: [],
            testTransformMode: {}
          },
          projects: [
            {
              path: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest',
              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.*/**' ],
                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}?(-d).?(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}'
                  ],
                  reportOnFailure: false,
                  reporter: [ [ 'text', {} ], [ 'html', {} ], [ 'clover', {} ], [ 'json', {} ] ],
                  extension: [
                    '.js',    '.cjs',
                    '.mjs',   '.ts',
                    '.mts',   '.cts',
                    '.tsx',   '.jsx',
                    '.vue',   '.svelte',
                    '.marko'
                  ],
                  allowExternal: false,
                  ignoreEmptyLines: false,
                  processingConcurrency: 12
                },
                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,
                disableConsoleIntercept: false,
                poolOptions: { threads: {}, forks: {} },
                config: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/vitest.config.mts',
                defines: {},
                root: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest',
                mode: 'test',
                inspector: { enabled: false, waitForDebugger: false },
                clearScreen: true,
                browser: { fileParallelism: false, enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
                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/.vite' } },
                snapshotOptions: { expand: false, snapshotFormat: {}, updateSnapshot: 'new', snapshotEnvironment: null },
                snapshotSerializers: [],
                poolMatchGlobs: [],
                setupFiles: [],
                globalSetup: [],
                cache: { dir: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/node_modules/.vite/vitest' },
                sequence: { hooks: 'parallel' },
                environmentMatchGlobs: [],
                testTransformMode: {}
              }
            }
          ],
          package: {
            version: '1.6.0',
            urls: { hooks: 'file://<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.381/wallaby75b228/runners/node/hooks.mjs' },
            paths: {
              root: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/node_modules/vitest',
              dist: '<homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/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: '**/*.timestamp-*', ignore: true, trigger: true, load: true, file: 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: 8192 }, autoExpand: { elements: 5000, stringLength: 8192, depth: 10 } } },
    preprocessors: {},
    maxConsoleMessagesPerTest: 100,
    maxTraceSteps: 999999,
    maxTraceStepsForWatchExpressionPrefetch: 0,
    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: {},
    env: {
      type: 'node',
      params: {},
      runner: '<homeDir>/.nvm/versions/node/v20.15.1/bin/node',
      viewportSize: { width: 800, height: 600 },
      options: { width: 800, height: 600 },
      bundle: true
    },
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    runAllTestsWhenNoAffectedTests: true,
    symlinkNodeModules: undefined,
    configCode: 'auto.detect#-1486913993'
  },
  packageJSON: {
    dependencies: { '@nestjs/common': '^10.0.0', '@nestjs/core': '^10.0.0', '@nestjs/platform-express': '^10.0.0', 'reflect-metadata': '^0.1.13', rxjs: '^7.8.1' },
    devDependencies: {
      '@nestjs/cli': '^10.0.0',
      '@nestjs/schematics': '^10.0.0',
      '@nestjs/testing': '^10.0.0',
      '@types/express': '^4.17.17',
      '@types/node': '^20.3.1',
      '@types/supertest': '^6.0.0',
      '@typescript-eslint/eslint-plugin': '^6.0.0',
      '@typescript-eslint/parser': '^6.0.0',
      eslint: '^8.42.0',
      'eslint-config-prettier': '^9.0.0',
      'eslint-plugin-prettier': '^5.0.0',
      prettier: '^3.0.0',
      'source-map-support': '^0.5.21',
      supertest: '^6.3.3',
      'ts-loader': '^9.4.3',
      'ts-node': '^10.9.1',
      'tsconfig-paths': '^4.2.0',
      typescript: '^5.1.3',
      'unplugin-swc': '1.5.1',
      'vite-tsconfig-paths': '^4.3.1',
      vitest: '1.6.0'
    }
  },
  fs: { numberOfFiles: 16 },
  debug: [
    '2024-08-08T20:14:53.810Z project waiting for initial run signal\n',
    '2024-08-08T20:14:53.812Z model Initialization Completed: 90ms\n',
    '2024-08-08T20:14:53.814Z config Attempting automatic configuration for vitest\n',
    '2024-08-08T20:14:53.815Z vitest/config Detected Vitest (1.6.0).\n',
    '2024-08-08T20:14:54.137Z config Finished attempting automatic configuration for vitest (323ms)\n',
    '2024-08-08T20:14:54.137Z project Wallaby Node version: v20.15.1\n',
    '2024-08-08T20:14:54.137Z project Wallaby config: <homeDir>/Documents/work/Foci/projects/Requiremint/repos/nestjs-vitest/auto.detect\n',
    '2024-08-08T20:14:54.159Z fs File system starting\n',
    '2024-08-08T20:14:54.172Z fs File system scan completed\n',
    '2024-08-08T20:14:54.176Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.381/projects/e6c2feb3028722c8\n',
    '2024-08-08T20:14:54.197Z ui.service.legacy Listening port 51235\n',
    '2024-08-08T20:14:54.202Z project package.json file change detected, invalidating local cache\n',
    '2024-08-08T20:14:54.204Z workers Parallelism for initial run: 1, for regular run: 1\n',
    '2024-08-08T20:14:54.204Z workers Starting run worker instance #0\n',
    '2024-08-08T20:14:54.204Z workers Web server is listening at 56913\n',
    '2024-08-08T20:14:54.204Z project File cache requires some updates, waiting required files from IDE\n',
    '2024-08-08T20:14:54.212Z project Stopping process pool\n',
    '2024-08-08T20:14:54.214Z project Test run started; run priority: 3\n',
    '2024-08-08T20:14:54.214Z project Running all tests\n',
    '2024-08-08T20:14:54.222Z workers Starting test run, priority: 3\n',
    '2024-08-08T20:14:54.222Z nodeRunner Starting sandbox [worker #0, session #1k3g2]\n',
    '2024-08-08T20:14:54.222Z nodeRunner Preparing sandbox [worker #0, session #1k3g2]\n',
    '2024-08-08T20:14:54.273Z workers Started run worker instance (delayed) #0\n',
    '2024-08-08T20:14:54.273Z nodeRunner Prepared sandbox [worker #0, session #1k3g2]\n',
    '2024-08-08T20:14:54.273Z workers [worker #0, session #1k3g2] Running tests in sandbox\n',
    "2024-08-08T20:14:54.517Z workers 'Scheduling Vitest Run (1k3g2): 2024-08-08T20:14:54.516Z'\n",
    '2024-08-08T20:14:54.648Z workers Sandbox (active) [1k3g2] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:5:1]\n' +
      " \x1B[2m 5\x1B[0m | import { describe, it, beforeEach } from 'vitest';\n" +
      ' \x1B[2m 6\x1B[0m | \n' +
      " \x1B[2m 7\x1B[0m | describe('AppController (e2e)', () => {\n" +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      '    : \x1B[31;1m         ^\x1B[0m\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m 'const' declarations must be initialized\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:8:1]\n' +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m          ^^^^^^^^^^^^^\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:8:1]\n' +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m                       ^\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expression expected\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:10:1]\n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    : \x1B[31;1m    ^\x1B[0m\n' +
      ' \x1B[2m14\x1B[0m | \n' +
      ' \x1B[2m15\x1B[0m |     app = moduleFixture.createNestApplication();\n' +
      ' \x1B[2m16\x1B[0m |     await app.init();\n' +
      '    `----\n' +
      '\n' +
      '\n' +
      'Caused by:\n' +
      '    Syntax Error\n' +
      '    at <rootDir>/test/app.spec.ts:1:3454\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vite-node/dist/client.mjs:362:11)\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vitest/dist/vendor/execute.fL3szUAI.js:554:20)\n' +
      '    at VitestExecutor.directRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:346:16)\n' +
      '    at VitestExecutor.cachedRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:189:14)\n' +
      '    at VitestExecutor.executeId (file://<rootDir>/node_modules/vite-node/dist/client.mjs:165:12)\n' +
      '    at collectTestsPatched (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:628:7)\n' +
      '    at collectTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:607:61)\n' +
      '    at startTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:964:17)\n' +
      '    at file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:116:7\n' +
      '    at withEnv (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:83:5)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:105:3)\n' +
      '    at runBaseTests (file://<rootDir>/node_modules/vitest/dist/vendor/base.Ybri3C14.js:30:3)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/worker.js:99:5)\n' +
      '    at file://<rootDir>/node_modules/tinypool/dist/esm/entry/worker.js:72:20\n',
    '2024-08-08T20:14:54.649Z workers Sandbox (active) [1k3g2] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '   ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:3:1]\n' +
      " \x1B[2m3\x1B[0m | import { AppService } from './app.service';\n" +
      " \x1B[2m4\x1B[0m | import { describe, it, beforeEach, expect } from 'vitest';\n" +
      " \x1B[2m5\x1B[0m | describe('AppController', () => {\n" +
      ' \x1B[2m6\x1B[0m |   let appController: AppController;\n' +
      '   : \x1B[31;1m                   ^\x1B[0m\n' +
      ' \x1B[2m7\x1B[0m | \n' +
      ' \x1B[2m8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '   `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m 'const' declarations must be initialized\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:6:1]\n' +
      ' \x1B[2m 6\x1B[0m |   let appController: AppController;\n' +
      ' \x1B[2m 7\x1B[0m | \n' +
      ' \x1B[2m 8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m          ^^^\x1B[0m\n' +
      ' \x1B[2m10\x1B[0m |       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m |       providers: [AppService],\n' +
      ' \x1B[2m12\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:6:1]\n' +
      ' \x1B[2m 6\x1B[0m |   let appController: AppController;\n' +
      ' \x1B[2m 7\x1B[0m | \n' +
      ' \x1B[2m 8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m             ^\x1B[0m\n' +
      ' \x1B[2m10\x1B[0m |       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m |       providers: [AppService],\n' +
      ' \x1B[2m12\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m Expected ';', '}' or <eof>\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:7:1]\n' +
      ' \x1B[2m 7\x1B[0m |     \n' +
      ' \x1B[2m 8\x1B[0m |       beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |         const app: TestingModule = await Test.createTestingModule({\n' +
      ' \x1B[2m10\x1B[0m | \x1B[31;1m,\x1B[0m\x1B[31;1m-\x1B[0m\x1B[31;1m>\x1B[0m       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m | \x1B[31;1m|\x1B[0m\x1B[31;1m-\x1B[0m\x1B[31;1m>\x1B[0m       providers: [AppService],\n' +
      '    : \x1B[31;1m`\x1B[0m\x1B[31;1m---\x1B[0m\x1B[33;1m               ^\x1B[0m\n' +
      '    : \x1B[31;1m`\x1B[0m\x1B[31;1m---\x1B[0m\x1B[31;1m-\x1B[0m \x1B[31;1mThis is the expression part of an expression statement\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |         }).compile();\n' +
      ' \x1B[2m13\x1B[0m |     \n' +
      ' \x1B[2m14\x1B[0m |         appController = app.get<AppController>(AppController);\n' +
      '    `----\n' +
      '\n' +
      '\n' +
      'Caused by:\n' +
      '    Syntax Error\n' +
      '    at <rootDir>/src/app.controller.spec.ts:1:4064\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vite-node/dist/client.mjs:362:11)\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vitest/dist/vendor/execute.fL3szUAI.js:554:20)\n' +
      '    at VitestExecutor.directRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:346:16)\n' +
      '    at VitestExecutor.cachedRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:189:14)\n' +
      '    at VitestExecutor.executeId (file://<rootDir>/node_modules/vite-node/dist/client.mjs:165:12)\n' +
      '    at collectTestsPatched (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:628:7)\n' +
      '    at collectTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:607:61)\n' +
      '    at startTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:964:17)\n' +
      '    at file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:116:7\n' +
      '    at withEnv (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:83:5)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:105:3)\n' +
      '    at runBaseTests (file://<rootDir>/node_modules/vitest/dist/vendor/base.Ybri3C14.js:30:3)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/worker.js:99:5)\n' +
      '    at file://<rootDir>/node_modules/tinypool/dist/esm/entry/worker.js:72:20\n',
    '2024-08-08T20:14:54.649Z workers [1k3g2.1] Loaded unknown number of test(s)\n',
    '2024-08-08T20:14:54.649Z workers [1k3g2.2] Loaded unknown number of test(s)\n',
    '2024-08-08T20:14:54.655Z workers Sandbox (active) [1k3g2] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '   ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:3:1]\n' +
      " \x1B[2m3\x1B[0m | import { AppService } from './app.service';\n" +
      " \x1B[2m4\x1B[0m | import { describe, it, beforeEach, expect } from 'vitest';\n" +
      " \x1B[2m5\x1B[0m | describe('AppController', () => {\n" +
      ' \x1B[2m6\x1B[0m |   let appController: AppController;\n' +
      '   : \x1B[31;1m                   ^\x1B[0m\n' +
      ' \x1B[2m7\x1B[0m | \n' +
      ' \x1B[2m8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '   `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m 'const' declarations must be initialized\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:6:1]\n' +
      ' \x1B[2m 6\x1B[0m |   let appController: AppController;\n' +
      ' \x1B[2m 7\x1B[0m | \n' +
      ' \x1B[2m 8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m          ^^^\x1B[0m\n' +
      ' \x1B[2m10\x1B[0m |       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m |       providers: [AppService],\n' +
      ' \x1B[2m12\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:6:1]\n' +
      ' \x1B[2m 6\x1B[0m |   let appController: AppController;\n' +
      ' \x1B[2m 7\x1B[0m | \n' +
      ' \x1B[2m 8\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |     const app: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m             ^\x1B[0m\n' +
      ' \x1B[2m10\x1B[0m |       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m |       providers: [AppService],\n' +
      ' \x1B[2m12\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m Expected ';', '}' or <eof>\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/src/app.controller.spec.ts?wallaby=1723148094209\x1B[0m:7:1]\n' +
      ' \x1B[2m 7\x1B[0m |     \n' +
      ' \x1B[2m 8\x1B[0m |       beforeEach(async () => {\n' +
      ' \x1B[2m 9\x1B[0m |         const app: TestingModule = await Test.createTestingModule({\n' +
      ' \x1B[2m10\x1B[0m | \x1B[31;1m,\x1B[0m\x1B[31;1m-\x1B[0m\x1B[31;1m>\x1B[0m       controllers: [AppController],\n' +
      ' \x1B[2m11\x1B[0m | \x1B[31;1m|\x1B[0m\x1B[31;1m-\x1B[0m\x1B[31;1m>\x1B[0m       providers: [AppService],\n' +
      '    : \x1B[31;1m`\x1B[0m\x1B[31;1m---\x1B[0m\x1B[33;1m               ^\x1B[0m\n' +
      '    : \x1B[31;1m`\x1B[0m\x1B[31;1m---\x1B[0m\x1B[31;1m-\x1B[0m \x1B[31;1mThis is the expression part of an expression statement\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |         }).compile();\n' +
      ' \x1B[2m13\x1B[0m |     \n' +
      ' \x1B[2m14\x1B[0m |         appController = app.get<AppController>(AppController);\n' +
      '    `----\n' +
      '\n' +
      '\n' +
      'Caused by:\n' +
      '    Syntax Error\n' +
      '    at <rootDir>/src/app.controller.spec.ts:1:4064\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vite-node/dist/client.mjs:362:11)\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vitest/dist/vendor/execute.fL3szUAI.js:554:20)\n' +
      '    at VitestExecutor.directRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:346:16)\n' +
      '    at VitestExecutor.cachedRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:189:14)\n' +
      '    at VitestExecutor.executeId (file://<rootDir>/node_modules/vite-node/dist/client.mjs:165:12)\n' +
      '    at collectTestsPatched (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:628:7)\n' +
      '    at collectTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:607:61)\n' +
      '    at startTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:964:17)\n' +
      '    at file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:116:7\n' +
      '    at withEnv (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:83:5)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:105:3)\n' +
      '    at runBaseTests (file://<rootDir>/node_modules/vitest/dist/vendor/base.Ybri3C14.js:30:3)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/worker.js:99:5)\n' +
      '    at file://<rootDir>/node_modules/tinypool/dist/esm/entry/worker.js:72:20\n',
    '2024-08-08T20:14:54.655Z workers Sandbox (active) [1k3g2] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:5:1]\n' +
      " \x1B[2m 5\x1B[0m | import { describe, it, beforeEach } from 'vitest';\n" +
      ' \x1B[2m 6\x1B[0m | \n' +
      " \x1B[2m 7\x1B[0m | describe('AppController (e2e)', () => {\n" +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      '    : \x1B[31;1m         ^\x1B[0m\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    `----\n' +
      '\n' +
      "  \x1B[31mx\x1B[0m 'const' declarations must be initialized\n" +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:8:1]\n' +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m          ^^^^^^^^^^^^^\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:8:1]\n' +
      ' \x1B[2m 8\x1B[0m |   let app: INestApplication;\n' +
      ' \x1B[2m 9\x1B[0m | \n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    : \x1B[31;1m                       ^\x1B[0m\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  \x1B[31mx\x1B[0m Expression expected\n' +
      '    ,-[\x1B[36;1;4m<rootDir>/test/app.spec.ts?wallaby=1723148094209\x1B[0m:10:1]\n' +
      ' \x1B[2m10\x1B[0m |   beforeEach(async () => {\n' +
      ' \x1B[2m11\x1B[0m |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      ' \x1B[2m12\x1B[0m |       imports: [AppModule],\n' +
      ' \x1B[2m13\x1B[0m |     }).compile();\n' +
      '    : \x1B[31;1m    ^\x1B[0m\n' +
      ' \x1B[2m14\x1B[0m | \n' +
      ' \x1B[2m15\x1B[0m |     app = moduleFixture.createNestApplication();\n' +
      ' \x1B[2m16\x1B[0m |     await app.init();\n' +
      '    `----\n' +
      '\n' +
      '\n' +
      'Caused by:\n' +
      '    Syntax Error\n' +
      '    at <rootDir>/test/app.spec.ts:1:3454\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vite-node/dist/client.mjs:362:11)\n' +
      '    at VitestExecutor.runModule (file://<rootDir>/node_modules/vitest/dist/vendor/execute.fL3szUAI.js:554:20)\n' +
      '    at VitestExecutor.directRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:346:16)\n' +
      '    at VitestExecutor.cachedRequest (file://<rootDir>/node_modules/vite-node/dist/client.mjs:189:14)\n' +
      '    at VitestExecutor.executeId (file://<rootDir>/node_modules/vite-node/dist/client.mjs:165:12)\n' +
      '    at collectTestsPatched (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:628:7)\n' +
      '    at collectTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:607:61)\n' +
      '    at startTests (file://<rootDir>/node_modules/@vitest/runner/dist/index.js:964:17)\n' +
      '    at file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:116:7\n' +
      '    at withEnv (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:83:5)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/chunks/runtime-runBaseTests.oAvMKtQC.js:105:3)\n' +
      '    at runBaseTests (file://<rootDir>/node_modules/vitest/dist/vendor/base.Ybri3C14.js:30:3)\n' +
      '    at run (file://<rootDir>/node_modules/vitest/dist/worker.js:99:5)\n' +
      '    at file://<rootDir>/node_modules/tinypool/dist/esm/entry/worker.js:72:20\n',
    "2024-08-08T20:14:54.656Z workers 'Vitest Run Complete (1k3g2): 2024-08-08T20:14:54.655Z'\n",
    '2024-08-08T20:14:54.656Z workers [1k3g2] Run 0 test(s), skipped 0 test(s)\n',
    '2024-08-08T20:14:54.656Z workers [1k3g2] Sandbox is responsive, closing it\n',
    '2024-08-08T20:14:54.670Z project Test run finished\n',
    '2024-08-08T20:14:54.671Z project Processed console.log entries\n',
    '2024-08-08T20:14:54.671Z project Processed loading sequences\n',
    '2024-08-08T20:14:54.671Z project Processed executed tests\n',
    '2024-08-08T20:14:54.672Z project Processed code coverage\n',
    '2024-08-08T20:14:54.692Z project Test run result processed and sent to IDE\n',
    '2024-08-08T20:14:54.694Z fs No metadata for added file found: node_modules/.vite/vitest/results.json\n'
  ]
}
smcenlly commented 2 months ago

Thanks for reporting the problem and for the sample repo.

As mentioned in the previous issue, unplugin-swc doesn't ignore query string parameters of file import URLs, so we patch their logic at runtime to correctly handle this case. The latest version of unplugin-swc changed file locations which broke our integration.

This is fixed in the latest version of Wallaby core, v1.0.1592.