wallabyjs / public

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

TypeScript transpilation errors with vitest and unplugin-swc #3329

Closed ShymkivD closed 9 months ago

ShymkivD commented 9 months ago

Issue description or question

When Vitest is configured with unplugin-swc, Wallaby is unable to transpile TypeScript. This problem has been observed with multiple projects that use decorators and rely on both Vitest and swc.

Minimal sample repo: https://github.com/ShymkivD/nestjs-vitest

Wallaby diagnostics report

{
  editorVersion: '1.85.2',
  pluginVersion: '1.0.371',
  editorType: 'VSCode',
  osVersion: 'darwin 23.2.0',
  nodeVersion: 'v20.11.0',
  coreVersion: '1.0.1520',
  checksum: 'MTcxYzJhMTJkOWI4YzAwZjY4NTJjODdkOTNhYTU2NGMsMTczNzg0OTYwMDAwMCww',
  config: {
    debug: true,
    env: { type: 'node', params: {}, runner: '<homeDir>/.nvm/versions/node/v20.11.0/bin/node', viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
    testFramework: { version: 'vitest@0.14.0', configurator: 'vitest@0.14.0', reporter: 'vitest@0.14.0', starter: 'vitest@0.14.0', configFile: 'vitest.config.mts', autoDetected: true },
    diagnostics: {
      vitest: {
        file: {
          config: "import swc from 'unplugin-swc';\n" +
            "import tsConfigPaths from 'vite-tsconfig-paths';\n" +
            "import { defineConfig } from 'vitest/config';\n" +
            '\n' +
            'export default defineConfig({\n' +
            '  plugins: [\n' +
            '    tsConfigPaths(),\n' +
            '    swc.vite({\n' +
            "      module: { type: 'es6' },\n" +
            '    }),\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.*/**' ],
            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}'
              ],
              reportOnFailure: false,
              reporter: [ [ 'text', {} ], [ 'html', {} ], [ 'clover', {} ], [ 'json', {} ] ],
              extension: [
                '.js',    '.cjs',
                '.mjs',   '.ts',
                '.mts',   '.cts',
                '.tsx',   '.jsx',
                '.vue',   '.svelte',
                '.marko'
              ],
              allowExternal: false,
              processingConcurrency: 10
            },
            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>/Projects/playground/node/nestjs-vitest/vitest.config.mts',
            defines: {},
            root: '<homeDir>/Projects/playground/node/nestjs-vitest',
            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: [],
            setupFiles: [],
            globalSetup: [],
            cache: { dir: '<homeDir>/Projects/playground/node/nestjs-vitest/node_modules/.vitest' },
            sequence: { hooks: 'parallel' },
            environmentMatchGlobs: [],
            browser: { enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
            testTransformMode: {}
          },
          projects: [
            {
              path: '<homeDir>/Projects/playground/node/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}.?(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,
                  processingConcurrency: 10
                },
                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>/Projects/playground/node/nestjs-vitest/vitest.config.mts',
                defines: {},
                root: '<homeDir>/Projects/playground/node/nestjs-vitest',
                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: [],
                setupFiles: [],
                globalSetup: [],
                cache: { dir: '<homeDir>/Projects/playground/node/nestjs-vitest/node_modules/.vitest' },
                sequence: { hooks: 'parallel' },
                environmentMatchGlobs: [],
                browser: { enabled: false, headless: false, slowHijackESM: false, isolate: true, api: { middlewareMode: true } },
                testTransformMode: {}
              }
            }
          ],
          package: {
            version: '1.2.2',
            urls: { hooks: 'file://<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.371/wallabyf52293/runners/node/hooks.mjs' },
            paths: { root: '<homeDir>/Projects/playground/node/nestjs-vitest/node_modules/vitest', dist: '<homeDir>/Projects/playground/node/nestjs-vitest/node_modules/vitest/dist' }
          }
        }
      }
    },
    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: undefined,
    configCode: "module.exports = () => ({\n  autoDetect: ['vitest'],\n  debug: true,\n  env: { type: 'node' },\n  testFramework: {\n    configFile: 'vitest.config.mts',\n  },\n});\n"
  },
  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.4.4',
      'vite-tsconfig-paths': '^4.3.1',
      vitest: '^1.2.2'
    }
  },
  fs: { numberOfFiles: 16 },
  debug: [
    '2024-02-01T12:06:54.432Z project waiting for initial run signal\n',
    '2024-02-01T12:06:54.438Z config Attempting automatic configuration for vitest\n',
    '2024-02-01T12:06:54.439Z vitest/config Detected Vitest (1.2.2).\n',
    '2024-02-01T12:06:54.740Z config Finished attempting automatic configuration for vitest (302ms)\n',
    '2024-02-01T12:06:54.741Z project Wallaby Node version: v20.11.0\n',
    '2024-02-01T12:06:54.741Z project Wallaby config: <homeDir>/Projects/playground/node/nestjs-vitest/wallaby.js\n',
    '2024-02-01T12:06:54.769Z fs File system starting\n',
    '2024-02-01T12:06:54.787Z fs File system scan completed\n',
    '2024-02-01T12:06:54.790Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.371/projects/493ce6f58a60ffc2\n',
    '2024-02-01T12:06:54.794Z uiService Listening port 51244\n',
    '2024-02-01T12:06:54.812Z workers Parallelism for initial run: 1, for regular run: 1\n',
    '2024-02-01T12:06:54.812Z workers Starting run worker instance #0\n',
    '2024-02-01T12:06:54.813Z workers Web server is listening at 51985\n',
    '2024-02-01T12:06:54.814Z project Stopping process pool\n',
    '2024-02-01T12:06:54.814Z project File cache is up-to-date, starting full test run\n',
    '2024-02-01T12:06:54.815Z project Test run started; run priority: 3\n',
    '2024-02-01T12:06:54.815Z project Running all tests\n',
    '2024-02-01T12:06:54.816Z workers Starting test run, priority: 3\n',
    '2024-02-01T12:06:54.816Z nodeRunner Starting sandbox [worker #0, session #3elhu]\n',
    '2024-02-01T12:06:54.816Z nodeRunner Preparing sandbox [worker #0, session #3elhu]\n',
    '2024-02-01T12:06:54.901Z workers Started run worker instance (delayed) #0\n',
    '2024-02-01T12:06:54.901Z nodeRunner Prepared sandbox [worker #0, session #3elhu]\n',
    '2024-02-01T12:06:54.901Z workers [worker #0, session #3elhu] Running tests in sandbox\n',
    "2024-02-01T12:06:55.160Z workers 'Scheduling Vitest Run (3elhu): 2024-02-01T12:06:55.147Z'\n",
    '2024-02-01T12:06:55.235Z fs No metadata for added file found: node_modules/.vitest/deps/_metadata.json\n',
    '2024-02-01T12:06:55.235Z fs No metadata for added file found: node_modules/.vitest/deps/package.json\n',
    '2024-02-01T12:06:55.298Z workers Sandbox (active) [3elhu] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m./test/app.spec.ts?wallaby=1706789026501\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./test/app.spec.ts?wallaby=1706789026501\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./test/app.spec.ts?wallaby=1706789026501\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./test/app.spec.ts?wallaby=1706789026501\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',
    '2024-02-01T12:06:55.299Z workers Sandbox (active) [3elhu] error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '   ,-[\x1B[36;1;4m./src/app.controller.spec.ts?wallaby=1706788653191\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./src/app.controller.spec.ts?wallaby=1706788653191\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./src/app.controller.spec.ts?wallaby=1706788653191\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./src/app.controller.spec.ts?wallaby=1706788653191\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',
    '2024-02-01T12:06:55.299Z workers [3elhu.2] Loaded unknown number of test(s)\n',
    '2024-02-01T12:06:55.299Z workers [3elhu.1] Loaded unknown number of test(s)\n',
    "2024-02-01T12:06:55.318Z workers 'Vitest Run Complete (3elhu): 2024-02-01T12:06:55.315Z'\n",
    '2024-02-01T12:06:55.319Z workers [3elhu] Run 0 test(s), skipped 0 test(s)\n',
    '2024-02-01T12:06:55.331Z workers [3elhu] Sandbox is responsive, closing it\n',
    '2024-02-01T12:06:55.331Z workers Failed to map the stack to user code, entry message: Error: \n' +
      '  x Expected a semicolon\n' +
      '    ,-[<homeDir>/Projects/playground/node/nestjs-vitest/test/app.spec.ts?wallaby=1706789026501:5:1]\n' +
      "  5 | import { describe, it, beforeEach } from 'vitest';\n" +
      '  6 | \n' +
      "  7 | describe('AppController (e2e)', () => {\n" +
      '  8 |   let app: INestApplication;\n' +
      '    :          ^\n' +
      '  9 | \n' +
      ' 10 |   beforeEach(async () => {\n' +
      ' 11 |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    `----\n' +
      '\n' +
      "  x 'const' declarations must be initialized\n" +
      '    ,-[<homeDir>/Projects/playground/node/nestjs-vitest/test/app.spec.ts?wallaby=1706789026501:8:1]\n' +
      '  8 |   let app: INestApplication;\n' +
      '  9 | \n' +
      ' 10 |   beforeEach(async () => {\n' +
      ' 11 |     const moduleFixture: TestingModule = await Test.createTestingModule({\n' +
      '    :           ^^^^^^^^^^^^^\n' +
      ' 12 |       imports: [AppModule],\n' +
      ' 13 |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  x Expected a semicolon\n' +
      '    ,-[<homeDir>/Projects/playground/node/nestjs-vitest/test/app.spec.ts?wallaby=1706789026501:8:1]\n' +
      '  8 |   let app: INestApplication;\n' +
      '  9 | \n' +
      ' 10 |   beforeEach(async () =, stack: Error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '    ,-[\x1B[36;1;4m<homeDir>/Projects/playground/node/nestjs-vitest/test/app.spec.ts?wallaby=1706789026501\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<homeDir>/Projects/playground/node/nestjs-vitest/test/app.spec.ts?wallaby=1706789026501\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 sem\n',
    '2024-02-01T12:06:55.332Z workers Failed to map the stack to user code, entry message: Error: \n' +
      '  x Expected a semicolon\n' +
      '   ,-[<homeDir>/Projects/playground/node/nestjs-vitest/src/app.controller.spec.ts?wallaby=1706788653191:3:1]\n' +
      " 3 | import { AppService } from './app.service';\n" +
      " 4 | import { describe, it, beforeEach, expect } from 'vitest';\n" +
      " 5 | describe('AppController', () => {\n" +
      ' 6 |   let appController: AppController;\n' +
      '   :                    ^\n' +
      ' 7 | \n' +
      ' 8 |   beforeEach(async () => {\n' +
      ' 9 |     const app: TestingModule = await Test.createTestingModule({\n' +
      '   `----\n' +
      '\n' +
      "  x 'const' declarations must be initialized\n" +
      '    ,-[<homeDir>/Projects/playground/node/nestjs-vitest/src/app.controller.spec.ts?wallaby=1706788653191:6:1]\n' +
      '  6 |   let appController: AppController;\n' +
      '  7 | \n' +
      '  8 |   beforeEach(async () => {\n' +
      '  9 |     const app: TestingModule = await Test.createTestingModule({\n' +
      '    :           ^^^\n' +
      ' 10 |       controllers: [AppController],\n' +
      ' 11 |       providers: [AppService],\n' +
      ' 12 |     }).compile();\n' +
      '    `----\n' +
      '\n' +
      '  x Expected a semicolon\n' +
      '    ,-[<homeDir>/Projects/playground/node/nestjs-vitest/src/app.controller.sp, stack: Error: \n' +
      '  \x1B[31mx\x1B[0m Expected a semicolon\n' +
      '   ,-[\x1B[36;1;4m<homeDir>/Projects/playground/node/nestjs-vitest/src/app.controller.spec.ts?wallaby=1706788653191\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<homeDir>/Projects/playground/node/nestjs-vitest/src/app.controller.spec.ts?wallaby=1706788653191\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 |\n',
    '2024-02-01T12:06:55.332Z project Test run finished\n',
    '2024-02-01T12:06:55.332Z project Processed console.log entries\n',
    '2024-02-01T12:06:55.332Z project Processed loading sequences\n',
    '2024-02-01T12:06:55.332Z project Processed executed tests\n',
    '2024-02-01T12:06:55.332Z project Processed code coverage\n',
    '2024-02-01T12:06:55.335Z project Test run result processed and sent to IDE\n',
    '2024-02-01T12:06:55.336Z fs No metadata for added file found: node_modules/.vitest/results.json\n'
  ]
}
smcenlly commented 9 months ago

Thanks for reporting the problem and for the sample repo.

Wallaby needs to add a cache breaker to file URLs (which is how files are referenced in vite / rollup) but unplugin-swc file matchers (to determine what to transform) do not consider that a suffix may exist (e.g. ?wallaby=timestamp).

We have fixed this problem in the latest version of Wallaby core, v1.0.1521. Wallaby should update for you automatically, but if it does not, you may run the VS Code command, Wallaby.js: Force Core Update.