wallabyjs / public

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

Vitest: errors from partial edits #3056

Closed tslocke closed 1 year ago

tslocke commented 2 years ago

Issue description or question

I'm still seeing a bunch of issues with Vitest. I was thinking they might be related to the one I reported yesterday but I'm still seeing them.

The diagnostics here are from a session like this:

Note the diagnostics is from before that final stop/start.

I'm also sometimes seeing a problem where Wallaby stops only sees the tests in the current file. i.e. the total in the status bar is suddenly just 6 or something.

(BTW, I realise I've been working on the assumption that the diagnostics report has details of the actual run, e.g. a stack trace, but skimming through it I don't see anything like that. Does it just have general info about my environment and nothing about what specifically just happened?)

Wallaby diagnostics report

{
  editorVersion: '1.70.1',
  pluginVersion: '1.0.346',
  editorType: 'VSCode',
  osVersion: 'darwin 21.4.0',
  nodeVersion: 'v16.15.1',
  coreVersion: '1.0.1322',
  checksum: 'MDY1YTZlY2QyZTAzNjNiNDliMmViMDE1ODI2MDE1NjMsMTY4MjcyNjQwMDAwMCww',
  config: {
    resolveGetters: true,
    logLimits: { inline: { depth: 12, elements: 5000 }, values: { default: { stringLength: 200 }, autoExpand: { elements: 5000, stringLength: 8192, depth: 10 } } },
    runMode: 'onSave',
    diagnostics: {
      vitest: {
        file: {
          config: "import { defineConfig, loadEnv } from 'vite'\n" +
            "import solid from 'vite-plugin-solid'\n" +
            "import tsconfigPaths from 'vite-tsconfig-paths'\n" +
            '\n' +
            'export default defineConfig(({mode}) => {\n' +
            '  process.env = {...process.env, ...loadEnv(mode, process.cwd())};\n' +
            '\n' +
            '  return {\n' +
            '    server: {\n' +
            '      port: +(process.env.VITE_PORT ?? 3000)\n' +
            '    },\n' +
            '\n' +
            '    plugins: [\n' +
            '      tsconfigPaths({loose: true}),\n' +
            '      solid()\n' +
            '    ],\n' +
            '\n' +
            '    build: {\n' +
            "      target: 'esnext',\n" +
            '      polyfillDynamicImport: false,\n' +
            '      minify: false,\n' +
            '      chunkSizeWarningLimit: 600,\n' +
            '      rollupOptions: {\n' +
            "        input: './src/main.tsx',\n" +
            '        output: {\n' +
            '          assetFileNames: "[name][extname]",\n' +
            '          chunkFileNames: "[name].js",\n' +
            '          entryFileNames: "[name].js",\n' +
            '          manualChunks: () => "main.js"\n' +
            '        }\n' +
            '      }\n' +
            '    },\n' +
            '\n' +
            '    optimizeDeps: {\n' +
            '      esbuildOptions: {\n' +
            "        target: 'esnext'\n" +
            '      }\n' +
            '    },\n' +
            '\n' +
            '    define: {\n' +
            `      ...(mode == 'production' ? {} : {'__REACT_DEVTOOLS_GLOBAL_HOOK__': '{ "isDisabled": true }'}),\n` +
            '      \n' +
            "      ...(mode == 'test' ? {} : \n" +
            '        {\n' +
            '          "process.env": {\n' +
            '            TAILWIND_MODE: JSON.stringify("build"),\n' +
            '          },\n' +
            '    \n' +
            '          "process.platform": JSON.stringify(""),\n' +
            '    \n' +
            '          "process.versions": null,\n' +
            '        }\n' +
            '      )\n' +
            '    },\n' +
            '\n' +
            '    test: {\n' +
            "      environment: 'jsdom',\n" +
            '      transformMode: {\n' +
            '        web: [/\\.[jt]sx?$/],\n' +
            '      },\n' +
            '      // solid needs to be inline to work around\n' +
            '      // a resolution issue in vitest:\n' +
            '      deps: {\n' +
            '        inline: [/solid-js/, /solid-app-router/],\n' +
            '      },\n' +
            '      // if you have few tests, try commenting one\n' +
            '      // or both out to improve performance:\n' +
            '      threads: false,\n' +
            '      isolate: false,\n' +
            '      globals: true\n' +
            '    },\n' +
            '\n' +
            '    resolve: {\n' +
            "      conditions: ['development', 'browser'],\n" +
            '      alias: [\n' +
            "        {find: 'glob-parent', replacement: 'src/fake-modules.ts'},\n" +
            "        {find: 'fast-glob', replacement: 'src/fake-modules.ts'},\n" +
            "        {find: 'fs', replacement: 'src/fake-modules.ts'},\n" +
            "        {find: 'os', replacement: 'src/fake-modules.ts'},\n" +
            "        {find: 'path', replacement: 'src/fake-modules.ts'},\n" +
            "        {find: 'url', replacement: 'node_modules/native-url/dist/index.js'},\n" +
            '      ]\n' +
            '    },\n' +
            '  }\n' +
            '})\n'
        },
        config: {
          allowOnly: true,
          watch: true,
          globals: true,
          environment: 'jsdom',
          threads: false,
          clearMocks: false,
          restoreMocks: false,
          mockReset: false,
          include: [ '**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}' ],
          exclude: [ '**/node_modules/**', '**/dist/**', '**/cypress/**', '**/.{idea,git,cache,output,temp}/**' ],
          testTimeout: 5000,
          hookTimeout: 10000,
          teardownTimeout: 1000,
          isolate: false,
          watchExclude: [ '**/node_modules/**', '**/dist/**' ],
          forceRerunTriggers: [ '**/package.json/**', '**/vitest.config.*/**', '**/vite.config.*/**' ],
          update: false,
          reporters: [ 'default' ],
          silent: false,
          ui: false,
          uiBase: '/__vitest__/',
          open: true,
          css: { include: [ {} ] },
          coverage: {
            enabled: false,
            clean: true,
            cleanOnRerun: false,
            reportsDirectory: '<homeDir>/Projects/Inio/inio/web/coverage',
            excludeNodeModules: true,
            exclude: [
              'coverage/**',
              'dist/**',
              'packages/*/test{,s}/**',
              '**/*.d.ts',
              'cypress/**',
              'test{,s}/**',
              'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
              '**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
              '**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
              '**/__tests__/**',
              '**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress}.config.{js,cjs,mjs,ts}',
              '**/.{eslint,mocha,prettier}rc.{js,cjs,yml}'
            ],
            reporter: [ 'text', 'html', 'clover' ],
            allowExternal: false,
            extension: [
              '.js',  '.cjs',
              '.mjs', '.ts',
              '.tsx', '.jsx',
              '.vue', '.svelte'
            ],
            tempDirectory: '<homeDir>/Projects/Inio/inio/web/coverage/tmp'
          },
          fakeTimers: { loopLimit: 10000, shouldClearNativeTimers: true, toFake: [ 'setTimeout', 'clearTimeout', 'setInterval', 'clearInterval', 'setImmediate', 'clearImmediate', 'Date' ] },
          maxConcurrency: 5,
          dangerouslyIgnoreUnhandledErrors: false,
          transformMode: { web: [ {} ] },
          deps: { inline: [ {}, {}, {}, {}, {}, {}, {}, {}, '@nuxt/test-utils' ], registerNodeLoader: false },
          defines: { __REACT_DEVTOOLS_GLOBAL_HOOK__: { isDisabled: true } },
          root: '<homeDir>/Projects/Inio/inio/web',
          snapshotOptions: { snapshotFormat: {}, updateSnapshot: 'new' },
          setupFiles: [],
          cache: { dir: '<homeDir>/Projects/Inio/inio/web/node_modules/.vitest' },
          sequence: {},
          package: {
            version: '0.21.1',
            urls: { hooks: 'file://<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.346/wallaby49ee32/runners/node/hooks.mjs' },
            paths: { root: '<homeDir>/Projects/Inio/inio/web/node_modules/vitest', dist: '<homeDir>/Projects/Inio/inio/web/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}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', 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: '**/*.*', 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: '**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}', ignore: false, trigger: true, load: true, test: true, order: 2 }
    ],
    workers: { initial: 1, regular: 1, recycle: false },
    filesWithNoCoverageCalculated: [],
    runAllTestsInAffectedTestFile: false,
    updateNoMoreThanOneSnapshotPerTestFileRun: false,
    compilers: {},
    preprocessors: {},
    maxConsoleMessagesPerTest: 100,
    autoConsoleLog: true,
    delays: { run: 0, edit: 100, update: 0 },
    teardown: undefined,
    hints: {
      ignoreCoverage: '__REGEXP /ignore coverage|istanbul ignore/',
      ignoreCoverageForFile: '__REGEXP /ignore file coverage/',
      commentAutoLog: '?',
      testFileSelection: { include: '__REGEXP /file\\.only/', exclude: '__REGEXP /file\\.skip/' }
    },
    automaticTestFileSelection: true,
    runSelectedTestsOnly: false,
    mapConsoleMessagesStackTrace: false,
    extensions: {},
    env: {
      type: 'node',
      params: { runner: '--experimental-loader=file://<homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.346/wallaby49ee32/runners/node/hooks.mjs' },
      runner: '<homeDir>/.fnm/node-versions/v16.15.1/installation/bin/node',
      viewportSize: { width: 800, height: 600 },
      options: { width: 800, height: 600 },
      bundle: true
    },
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    loose: undefined,
    symlinkNodeModules: undefined,
    configCode: 'module.exports = function () {\n  return {\n    resolveGetters: true,\n\n    logLimits: {\n      inline: {\n        depth: 12,\n      }\n    },\n\n    runMode: "onSave",\n\n  };\n};\n'
  },
  packageJSON: {
    dependencies: {
      '@floating-ui/dom': '^1.0.0',
      '@headlessui/react': '^1.6',
      '@sentry/browser': '^7.8.1',
      '@sentry/tracing': '^7.8.1',
      arangojs: '^7.6',
      axios: '^0.27',
      'browser-util-inspect': '^0.2.0',
      chevrotain: '^10.1.2',
      'escape-html': '^1.0.3',
      'fast-array-diff': '^1.0.1',
      'fractional-indexing': '^3.0',
      fuzzy: '^0.1',
      'hotkeys-js': '^3.8',
      inflection: '^1.13',
      mitt: '^3.0',
      nanoid: '^3.0',
      'native-url': '^0.3.4',
      'next-tick': '^1.1',
      postcss: '^8.4.14',
      'prosemirror-autocomplete': '^0.4',
      'prosemirror-commands': '^1.3',
      'prosemirror-dropcursor': '^1.5',
      'prosemirror-gapcursor': '^1.3',
      'prosemirror-history': '^1.3',
      'prosemirror-inputrules': '^1.2',
      'prosemirror-keymap': '^1.2',
      'prosemirror-model': '^1.18',
      'prosemirror-state': '^1.4',
      'prosemirror-transform': '^1.6',
      'prosemirror-view': '^1.26',
      'pusher-js': '^7.0',
      ramda: '^0.28',
      react: '^18.1',
      'react-dom': '^18.1',
      replicache: '^11.2',
      'solid-app-router': '^0.4',
      'solid-js': '^1.4',
      tailwindcss: '^3.1.6',
      'tippy.js': '^6.3',
      xregexp: '^5.1.1'
    },
    devDependencies: {
      '@tailwindcss/forms': '^0.5',
      '@tailwindcss/line-clamp': '^0.4',
      '@tailwindcss/typography': '^0.5',
      '@types/escape-html': '^1.0.2',
      '@types/inflection': '^1.13.0',
      '@types/next-tick': '^1.0.0',
      '@types/node': '^17.0',
      '@types/object-inspect': '^1.8.1',
      '@types/ramda': '^0.28',
      '@types/react': '^18.0',
      '@types/react-dom': '^18.0',
      autoprefixer: '^10.4',
      jsdom: '^20.0.0',
      'json-beautify': '^1.1',
      'object-inspect': '^1.11',
      'patch-package': '^6.4.7',
      'postinstall-postinstall': '^2.1.0',
      'ts-unused-exports': '^8.0',
      typescript: '^4.7',
      vite: '^3.0',
      'vite-plugin-solid': '^2.2',
      'vite-tsconfig-paths': '^3.4',
      vitest: '^0.21.1'
    }
  },
  fs: { numberOfFiles: 158 },
  debug: []
}
smcenlly commented 2 years ago

You should get debug output. Not sure why it's not outputting in your report.

I tried your dependencies and configuration and I don't seem to be able to reproduce any problems.

One thing that I did notice is that your runMode: 'onSave' should be runMode: 'onsave' but this won't be causing a problem, it just won't be only running on save for you.


Are you able to reproduce the issue in a repo you can share with us? Are you able to provide a screenshot of it not working for us?

smcenlly commented 1 year ago

Closing this issue as we didn't hear back; I think it's safe to close regardless as we have solved other issues since.