wallabyjs / public

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

Wallaby fails to show highlights when file is in `Titlecase` #3224

Closed chrisj-skinner closed 1 year ago

chrisj-skinner commented 1 year ago

Issue description or question

When I start up Wallaby and the test file name is all in lowercase. I see the green indicators. However when I change / and or start up Wallaby with the file name in titlecase. The green, and all other, highlights disappear. However the report still runs find, I just don't get the indicators.

Please see attached gif.

I've tried starting / stopping wallaby with the filename in lowercase first and then titlecase and vice versa. Then selecting custom config via folder selection, auto config setup but I always hit the same issue above and as seen below.

Do test files need to be in lowercase for Wallaby to work, or is there a setting somewhere I need to update? Thanks

Untitled

Wallaby diagnostics report

{
  editorVersion: '1.78.2',
  pluginVersion: '1.0.355',
  editorType: 'VSCode',
  osVersion: 'darwin 22.5.0',
  nodeVersion: 'v14.21.3',
  coreVersion: '1.0.1427',
  checksum: 'MDllZmRjMDYyODE3NWU0YjlkNTgyZWYxNGJhZGJlMzcsMTcxNTM4NTYwMDAwMCww',
  config: {
    diagnostics: {
      jest: {
        config: {
          configs: [
            {
              automock: false,
              cache: true,
              cacheDirectory: '/private/var/folders/17/lbwfcvfn369dshv7rxg3xrv80000gn/T/jest_dx',
              clearMocks: false,
              coveragePathIgnorePatterns: [ '/node_modules/' ],
              cwd: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components',
              dependencyExtractor: undefined,
              detectLeaks: false,
              detectOpenHandles: false,
              displayName: undefined,
              errorOnDeprecated: false,
              extensionsToTreatAsEsm: [],
              fakeTimers: { enableGlobally: false },
              filter: undefined,
              forceCoverageMatch: [],
              globalSetup: undefined,
              globalTeardown: undefined,
              globals: {},
              haste: { computeSha1: false, enableSymlinks: false, forceNodeFilesystemAPI: true, throwOnModuleCollision: false },
              id: '495889ceece5a59e55d5064bd1c9d5aa',
              injectGlobals: true,
              moduleDirectories: [ 'node_modules' ],
              moduleFileExtensions: [
                'js',   'mjs',
                'cjs',  'jsx',
                'ts',   'tsx',
                'json', 'node'
              ],
              moduleNameMapper: [ [ '.(css|less|scss)$', 'identity-obj-proxy' ] ],
              modulePathIgnorePatterns: [],
              modulePaths: undefined,
              openHandlesTimeout: 1000,
              prettierPath: 'prettier',
              resetMocks: false,
              resetModules: false,
              resolver: undefined,
              restoreMocks: false,
              rootDir: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components',
              roots: [ '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components' ],
              runner: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/node_modules/jest-runner/build/index.js',
              runtime: undefined,
              sandboxInjectedGlobals: [],
              setupFiles: [],
              setupFilesAfterEnv: [],
              skipFilter: false,
              skipNodeResolution: undefined,
              slowTestThreshold: 5,
              snapshotFormat: { escapeString: false, printBasicPrototype: false },
              snapshotResolver: undefined,
              snapshotSerializers: [],
              testEnvironment: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/node_modules/jest-environment-jsdom/build/index.js',
              testEnvironmentOptions: {},
              testLocationInResults: false,
              testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)' ],
              testPathIgnorePatterns: [ '/node_modules/' ],
              testRegex: [],
              testRunner: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/node_modules/jest-circus/runner.js',
              transform: [ [ '\\.[jt]sx?$', '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/node_modules/babel-jest/build/index.js', {} ] ],
              transformIgnorePatterns: [ '/node_modules/', '\\.pnp\\.[^\\/]+$' ],
              unmockedModulePathPatterns: undefined,
              watchPathIgnorePatterns: []
            }
          ],
          globalConfig: {
            bail: 0,
            changedFilesWithAncestor: false,
            changedSince: undefined,
            ci: false,
            collectCoverage: false,
            collectCoverageFrom: [],
            coverageDirectory: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/coverage',
            coverageProvider: 'babel',
            coverageReporters: [ 'json', 'text', 'lcov', 'clover' ],
            coverageThreshold: undefined,
            detectLeaks: false,
            detectOpenHandles: false,
            errorOnDeprecated: false,
            expand: false,
            filter: undefined,
            findRelatedTests: false,
            forceExit: false,
            globalSetup: undefined,
            globalTeardown: undefined,
            json: false,
            lastCommit: false,
            listTests: false,
            logHeapUsage: false,
            maxConcurrency: 5,
            maxWorkers: 7,
            noSCM: undefined,
            noStackTrace: false,
            nonFlagArgs: undefined,
            notify: false,
            notifyMode: 'failure-change',
            onlyChanged: false,
            onlyFailures: false,
            openHandlesTimeout: 1000,
            outputFile: undefined,
            passWithNoTests: false,
            projects: [],
            randomize: undefined,
            replname: undefined,
            reporters: undefined,
            rootDir: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components',
            runTestsByPath: false,
            seed: -1397165455,
            shard: undefined,
            showSeed: undefined,
            silent: undefined,
            skipFilter: false,
            snapshotFormat: { escapeString: false, printBasicPrototype: false },
            testFailureExitCode: 1,
            testNamePattern: undefined,
            testPathPattern: '',
            testResultsProcessor: undefined,
            testSequencer: '<homeDir>/Documents/Projects/work/b2bce-wp-ui-components/node_modules/@jest/test-sequencer/build/index.js',
            testTimeout: undefined,
            updateSnapshot: 'new',
            useStderr: false,
            verbose: undefined,
            watch: false,
            watchAll: false,
            watchPlugins: undefined,
            watchman: true,
            workerIdleMemoryLimit: undefined,
            workerThreads: false
          },
          hasDeprecationWarnings: false,
          wallaby: {
            roots: [],
            watchPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/', '/private/var/folders/17/lbwfcvfn369dshv7rxg3xrv80000gn/T/jest_dx', '\\./coverage' ],
            testPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/', '/private/var/folders/17/lbwfcvfn369dshv7rxg3xrv80000gn/T/jest_dx', '\\./coverage' ],
            testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)' ],
            testRegex: []
          }
        }
      }
    },
    testFramework: { version: 'jest@24.8.0', configurator: 'jest@24.8.0', reporter: 'jest@24.8.0', starter: 'jest@24.8.0', autoDetected: true },
    filesWithCoverageCalculated: [],
    filesWithNoCoverageCalculated: [],
    globalSetup: false,
    dot: true,
    files: [
      { pattern: '/node_modules/', regexp: /\/node_modules\//, ignore: true, trigger: true, load: true, file: true, test: true },
      {
        pattern: '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/',
        regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\.\/git\/|\/\..+\//,
        ignore: true,
        trigger: true,
        load: true,
        file: true,
        test: true
      },
      {
        pattern: '/private/var/folders/17/lbwfcvfn369dshv7rxg3xrv80000gn/T/jest_dx',
        regexp: /\/private\/var\/folders\/17\/lbwfcvfn369dshv7rxg3xrv80000gn\/T\/jest_dx/,
        ignore: true,
        trigger: true,
        load: true,
        file: true,
        test: true
      },
      { pattern: '\\./coverage', regexp: /\.\/coverage/, ignore: true, trigger: true, load: true, file: true, test: true },
      { pattern: '**/**', ignore: false, trigger: true, load: true, order: 1 },
      { pattern: '**/__tests__/**/*.[jt]s?(x)', ignore: true, trigger: true, load: true, file: true },
      { pattern: '**/?(*.)+(spec|test).[tj]s?(x)', ignore: true, trigger: true, load: true, file: true }
    ],
    captureConsoleLog: true,
    tests: [
      { pattern: '/node_modules/', regexp: /\/node_modules\//, ignore: true, trigger: true, load: true, test: true, file: false },
      {
        pattern: '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/',
        regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\.\/git\/|\/\..+\//,
        ignore: true,
        trigger: true,
        load: true,
        test: true,
        file: false
      },
      {
        pattern: '/private/var/folders/17/lbwfcvfn369dshv7rxg3xrv80000gn/T/jest_dx',
        regexp: /\/private\/var\/folders\/17\/lbwfcvfn369dshv7rxg3xrv80000gn\/T\/jest_dx/,
        ignore: true,
        trigger: true,
        load: true,
        test: true,
        file: false
      },
      { pattern: '\\./coverage', regexp: /\.\/coverage/, ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/__tests__/**/*.[jt]s?(x)', ignore: false, trigger: true, load: true, test: true, order: 2 },
      { pattern: '**/?(*.)+(spec|test).[tj]s?(x)', ignore: false, trigger: true, load: true, test: true, order: 3 }
    ],
    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 },
    workers: { initial: 0, regular: 0, recycle: false },
    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/v14.21.3/bin/node',
      viewportSize: { width: 800, height: 600 },
      options: { width: 800, height: 600 },
      bundle: true
    },
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    runAllTestsWhenNoAffectedTests: false,
    configCode: 'auto.detect#-1871660232'
  },
  packageJSON: {
    dependencies: undefined,
    devDependencies: {
      '@babel/core': '^7.21.8',
      '@babel/preset-env': '^7.21.5',
      '@babel/preset-react': '^7.18.6',
      '@babel/preset-typescript': '^7.21.5',
      '@rollup/plugin-commonjs': '^24.1.0',
      '@rollup/plugin-node-resolve': '^15.0.2',
      '@rollup/plugin-terser': '^0.4.1',
      '@rollup/plugin-typescript': '^11.1.0',
      '@storybook/addon-a11y': '^7.0.11',
      '@storybook/addon-essentials': '^7.0.11',
      '@storybook/addon-interactions': '^7.0.11',
      '@storybook/addon-links': '^7.0.11',
      '@storybook/addon-styling': '^1.0.8',
      '@storybook/blocks': '^7.0.11',
      '@storybook/react': '^7.0.11',
      '@storybook/react-webpack5': '^7.0.11',
      '@storybook/testing-library': '^0.0.14-next.2',
      '@testing-library/react': '^14.0.0',
      '@types/css-modules': '^1.0.2',
      '@types/jest': '^29.5.1',
      '@types/node': '^20.2.3',
      '@types/react': '^18.2.6',
      '@typescript-eslint/eslint-plugin': '^5.59.6',
      autoprefixer: '^10.4.14',
      'aws-cdk-lib': '^2.76.0',
      'babel-jest': '^29.5.0',
      'class-variance-authority': '^0.6.0',
      classnames: '^2.3.2',
      clsx: '^1.2.1',
      eslint: '^8.40.0',
      'eslint-plugin-cdk': '^1.8.0',
      'eslint-plugin-node': '^11.1.0',
      'eslint-plugin-storybook': '^0.6.12',
      'eslint-plugin-unused-imports': '^2.0.0',
      'identity-obj-proxy': '^3.0.0',
      jest: '^29.5.0',
      'jest-environment-jsdom': '^29.5.0',
      postcss: '^8.4.23',
      'prop-types': '^15.8.1',
      react: '^18.2.0',
      'react-dom': '^18.2.0',
      rollup: '^3.21.6',
      'rollup-plugin-dts': '^5.3.0',
      'rollup-plugin-peer-deps-external': '^2.2.4',
      'rollup-plugin-postcss': '^4.0.2',
      storybook: '^7.0.11',
      'storybook-css-modules': '^1.0.8',
      'tailwind-merge': '^1.12.0',
      tailwindcss: '^3.3.2',
      tslib: '^2.5.0',
      typescript: '^5.0.4'
    }
  },
  fs: { numberOfFiles: 30 },
  debug: [
    '2023-05-30T08:55:12.236Z config Attempting automatic configuration for angular\n',
    '2023-05-30T08:55:12.238Z angular/cli config Angular CLI not found.\n',
    '2023-05-30T08:55:12.238Z config Finished attempting automatic configuration for angular (2ms)\n',
    '2023-05-30T08:55:12.238Z config Attempting automatic configuration for jest\n',
    '2023-05-30T08:55:12.310Z jest/config Detected Jest.\n',
    '2023-05-30T08:55:12.310Z jest/config Configured Jest.\n',
    '2023-05-30T08:55:12.310Z config Finished attempting automatic configuration for jest (72ms)\n',
    '2023-05-30T08:55:12.311Z project Wallaby Node version: v14.21.3\n',
    '2023-05-30T08:55:12.311Z project Wallaby config: <homeDir>/Documents/Projects/work/b2bce-wp-ui-components/auto.detect\n',
    '2023-05-30T08:55:12.325Z fs File system starting\n',
    '2023-05-30T08:55:12.348Z fs File system scan completed\n',
    '2023-05-30T08:55:12.352Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.355/projects/aee781f854933a1c\n',
    '2023-05-30T08:55:12.398Z uiService Listening port 51235\n',
    '2023-05-30T08:55:12.403Z project package.json file change detected, invalidating local cache\n',
    '2023-05-30T08:55:12.410Z workers Parallelism for initial run: 6, for regular run: 3\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #0\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #1\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #2\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #3\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #4\n',
    '2023-05-30T08:55:12.411Z workers Starting run worker instance #5\n',
    '2023-05-30T08:55:12.411Z workers Web server is listening at 50394\n',
    '2023-05-30T08:55:12.411Z project File cache requires some updates, waiting required files from IDE\n',
    '2023-05-30T08:55:12.430Z project Stopping process pool\n',
    '2023-05-30T08:55:12.432Z project Test run started; run priority: 3\n',
    '2023-05-30T08:55:12.433Z project Running all tests\n',
    '2023-05-30T08:55:12.435Z workers Starting test run, priority: 3\n',
    '2023-05-30T08:55:12.435Z nodeRunner Starting sandbox [worker #0, session #jol6f]\n',
    '2023-05-30T08:55:12.435Z nodeRunner Preparing sandbox [worker #0, session #jol6f]\n',
    '2023-05-30T08:55:12.578Z workers Started run worker instance (delayed) #0\n',
    '2023-05-30T08:55:12.579Z nodeRunner Prepared sandbox [worker #0, session #jol6f]\n',
    '2023-05-30T08:55:12.579Z workers [worker #0, session #jol6f] Running tests in sandbox\n',
    '2023-05-30T08:55:12.584Z workers Started run worker instance (delayed) #1\n',
    '2023-05-30T08:55:12.616Z workers Started run worker instance (delayed) #3\n',
    '2023-05-30T08:55:12.617Z workers Started run worker instance (delayed) #2\n',
    '2023-05-30T08:55:12.618Z workers Started run worker instance (delayed) #4\n',
    '2023-05-30T08:55:12.624Z workers Started run worker instance (delayed) #5\n',
    '2023-05-30T08:55:15.321Z workers Scheduling Jest Test Run (jol6f): 2023-05-30T08:55:12.801Z\n',
    '2023-05-30T08:55:15.342Z workers [jol6f] Loaded unknown number of test(s)\n',
    '2023-05-30T08:55:15.343Z workers [jol6f] Test executed: should render Button component\n',
    '2023-05-30T08:55:15.343Z workers [jol6f] Test executed: should contain the text Waffel\n',
    '2023-05-30T08:55:15.343Z workers [jol6f] Test executed: should apply the default set of modifier classes"\n',
    '2023-05-30T08:55:15.346Z workers [jol6f] Run 3 test(s), skipped 0 test(s)\n',
    '2023-05-30T08:55:15.346Z workers Jest Test Run Complete (jol6f): 2023-05-30T08:55:15.318Z\n',
    '2023-05-30T08:55:15.349Z workers [jol6f] Sandbox is responsive, closing it\n',
    '2023-05-30T08:55:15.351Z project Test run finished\n',
    '2023-05-30T08:55:15.351Z project Processed console.log entries\n',
    '2023-05-30T08:55:15.351Z project Processed loading sequences\n',
    '2023-05-30T08:55:15.352Z project Processed executed tests\n',
    '2023-05-30T08:55:15.353Z project Processed code coverage\n',
    '2023-05-30T08:55:15.365Z project Test run result processed and sent to IDE\n',
    '2023-05-30T08:55:26.419Z fs File changed: src/components/Button/Button.spec.tsx\n',
    '2023-05-30T08:55:26.420Z fs No changes detected for src/components/Button/Button.spec.tsx\n',
    '2023-05-30T08:55:26.420Z extended-core File was not changed, but file markers may need to be synced\n'
  ]
}
smcenlly commented 1 year ago

Thanks for reporting the problem. We were able to reproduce your issue.

The problem is actually in VS Code and not Wallaby. The filename reported from the VS Code API after the rename change continues to be the previous name until you close the file and restart the editor with the file closed.

image

We may be able to work around the issue in our extension but I think the correct thing in this case is for VS Code to fix the issue; there are a lot of places where we rely on the correct filename being reported by the API and we'd prefer to hold off doing this unless the turn-around from the VS Code team takes a while.

I'll link to the VS Code issue once we reproduce the issue.

smcenlly commented 1 year ago

VS Code issue for tracking can be found here: https://github.com/microsoft/vscode/issues/183886

smcenlly commented 1 year ago

We attempted to show a warning as a fix to this problem but unfortunately the mechanism to warn is not robust and leads to false positives. We have removed the warning message. For now, this is a known limitation and sometimes you may have to manually close editor windows and restart the editor after making a case-sensitive filename change.

As a work around, you may try renaming to a different filename before changing the case, I believe this should work, for example:

  1. Rename file.js to file1.js
  2. Rename file1.js to File.js
chrisj-skinner commented 1 year ago

@smcenlly thanks