wallabyjs / public

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

Wallaby is inconsistent in deeply nested tests #3216

Closed Noriller closed 1 year ago

Noriller commented 1 year ago

Issue description or question

It's inconsistent, on some places I tried nesting it deeply (like 5+ levels of describe and then a test) and it worked, but on some files it just doesnt show any action. Control click to navigate to tests take me to the beforeEach of the describe block the test is in, or sometimes above in the tree.

I then tried right click on the test, but it shows "‌Line is not covered or covered not by tests" but in the beforeEach above it takes me to a test.

I couldn't really reproduce the "line not covered", but for the actions and navigate. Going to the output tab and control click on the test is taking me to the "import userEvent" line. Errors are also showing only up there.

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { useState } from 'react';

fdescribe('mocked describes', () => {
  beforeEach(async () => {
    render(<MockThing />);
  });

  describe('mocked describes', () => {
    it('mocked tests', async () => {
      expect(screen.getByText('mock1')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock1')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock1')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock1')).toBeInTheDocument();
    });
  });

  describe('mocked describes', () => {
    beforeEach(async () => {
      await userEvent.click(screen.getByRole('button'));
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock2')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock2')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock2')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock2')).toBeInTheDocument();
    });

    it('mocked tests', async () => {
      expect(screen.getByText('mock2')).toBeInTheDocument();
    });

    describe('mocked describes', () => {
      beforeEach(async () => {
        await userEvent.click(screen.getByRole('button'));
      });

      it('mocked tests', async () => {
        expect(screen.getByText('mock3')).toBeInTheDocument();
      });

      it('mocked tests', async () => {
        expect(screen.getByText('mock3')).toBeInTheDocument();
      });

      describe('mocked describes', () => {
        beforeEach(async () => {
          await userEvent.click(screen.getByRole('button'));
        });

        it('mocked tests', async () => {
          expect(screen.getByText('mock4')).toBeInTheDocument();
        });

        describe('mocked describes', () => {
          beforeEach(async () => {
            await userEvent.click(screen.getByRole('button'));
          });

          it('mocked tests', async () => {
            expect(screen.getByText('mock5')).toBeInTheDocument();
          });

          it('mocked tests', async () => {
            expect(screen.getByText('mock5')).toBeInTheDocument();
          });

          describe('mocked describes', () => {
            beforeEach(async () => {
              await userEvent.click(screen.getByRole('button'));
            });

            it('mocked tests', async () => {
              expect(screen.getByText('mock6')).toBeInTheDocument();
            });

            it('dont navigate to this test', async () => {
              expect(screen.getByText('error')).toBeInTheDocument();
            });
          });
        });
      });
    });
  });
});

function MockThing() {
  const [value, setValue] = useState(1);
  return <button type='button' onClick={() => setValue(value + 1)}>{`mock${value}`}</button>;
}

Image of how the error is showing:

image

Wallaby diagnostics report

{
  editorVersion: '1.78.2',
  pluginVersion: '1.0.355',
  editorType: 'VSCode',
  osVersion: 'linux 5.15.90.1-microsoft-standard-WSL2',
  nodeVersion: 'v18.10.0',
  coreVersion: '1.0.1423',
  checksum: 'Y2MwNDU0MDE3NGQ4MjljZTg0ZWNiNGMwYTY5NWNlMzQsMTcxNDg2NzIwMDAwMCww',
  config: {
    name: 'React',
    workers: { initial: 6, regular: 4, recycle: false },
    delays: { run: 0, edit: 100, update: 0 },
    ignoreFileLoadingDependencyTracking: true,
    runMode: 'onsave',
    maxLogEntrySize: 999999,
    diagnostics: {
      jest: {
        config: {
          configs: [
            {
              automock: false,
              cache: true,
              cacheDirectory: '/tmp/jest_rs',
              clearMocks: true,
              coveragePathIgnorePatterns: [ '/node_modules/' ],
              cwd: '<homeDir>/git/node/react',
              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: 'ddf1d29a6a2587b2368511d487b70357',
              injectGlobals: true,
              moduleDirectories: [ 'node_modules', 'src' ],
              moduleFileExtensions: [
                'js',   'mjs',
                'cjs',  'jsx',
                'ts',   'tsx',
                'json', 'node'
              ],
              moduleNameMapper: [
                [ '\\.(s?css|less|svg)$', '<homeDir>/git/node/react/test/__mocks__/styleMock.js' ],
                [ '^@test-utils$', '<homeDir>/git/node/react/test/test-utils.js' ],
                [ '^@/(.*)$', '<homeDir>/git/node/react/src/$1' ],
                [ '^components(.*)$', '<homeDir>/git/node/react/src/components/$1' ],
                [ '^config(.*)$', '<homeDir>/git/node/react/src/config/$1' ],
                [ '^hooks(.*)$', '<homeDir>/git/node/react/src/hooks/$1' ],
                [ '^layouts(.*)$', '<homeDir>/git/node/react/src/layouts/$1' ],
                [ '^pages(.*)$', '<homeDir>/git/node/react/src/pages/$1' ],
                [ '^services(.*)$', '<homeDir>/git/node/react/src/services/$1' ],
                [ '^utils(.*)$', '<homeDir>/git/node/react/src/utils/$1' ]
              ],
              modulePathIgnorePatterns: [],
              modulePaths: undefined,
              prettierPath: 'prettier',
              resetMocks: false,
              resetModules: false,
              resolver: undefined,
              restoreMocks: false,
              rootDir: '<homeDir>/git/node/react',
              roots: [ '<homeDir>/git/node/react' ],
              runner: '<homeDir>/git/node/react/node_modules/jest-runner/build/index.js',
              runtime: undefined,
              sandboxInjectedGlobals: [],
              setupFiles: [],
              setupFilesAfterEnv: [ '<homeDir>/git/node/react/test/setupTests.js' ],
              skipFilter: false,
              skipNodeResolution: undefined,
              slowTestThreshold: 5,
              snapshotFormat: undefined,
              snapshotResolver: undefined,
              snapshotSerializers: [],
              testEnvironment: '<homeDir>/git/node/react/node_modules/jest-environment-jsdom/build/index.js',
              testEnvironmentOptions: {},
              testLocationInResults: false,
              testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)', '!**/__tests__/**/utils.[jt]s?(x)', '!**/__tests__/**/*.no(spec|test).[jt]s?(x)' ],
              testPathIgnorePatterns: [ '/node_modules/' ],
              testRegex: [],
              testRunner: '<homeDir>/git/node/react/node_modules/jest-circus/runner.js',
              transform: [ [ '\\.[jt]sx?$', '<homeDir>/git/node/react/node_modules/babel-jest/build/index.js', {} ] ],
              transformIgnorePatterns: [ '/node_modules/', '\\.pnp\\.[^\\/]+$' ],
              unmockedModulePathPatterns: undefined,
              watchPathIgnorePatterns: []
            }
          ],
          globalConfig: {
            bail: 0,
            changedFilesWithAncestor: false,
            changedSince: undefined,
            ci: false,
            collectCoverage: true,
            collectCoverageFrom: [],
            collectCoverageOnlyFrom: undefined,
            coverageDirectory: '<homeDir>/git/node/react/coverage',
            coverageProvider: 'v8',
            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,
            outputFile: undefined,
            passWithNoTests: false,
            projects: [],
            replname: undefined,
            reporters: undefined,
            rootDir: '<homeDir>/git/node/react',
            runTestsByPath: false,
            shard: undefined,
            silent: undefined,
            skipFilter: false,
            snapshotFormat: undefined,
            testFailureExitCode: 1,
            testNamePattern: undefined,
            testPathPattern: '',
            testResultsProcessor: undefined,
            testSequencer: '<homeDir>/git/node/react/node_modules/@jest/test-sequencer/build/index.js',
            testTimeout: undefined,
            updateSnapshot: 'new',
            useStderr: false,
            verbose: undefined,
            watch: false,
            watchAll: false,
            watchPlugins: undefined,
            watchman: true
          },
          hasDeprecationWarnings: false,
          wallaby: {
            roots: [],
            watchPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/', '/tmp/jest_rs', '\\./coverage' ],
            testPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/', '/tmp/jest_rs', '\\./coverage' ],
            testMatch: [ '**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)', '!**/__tests__/**/utils.[jt]s?(x)', '!**/__tests__/**/*.no(spec|test).[jt]s?(x)' ],
            testRegex: []
          }
        }
      }
    },
    filesWithCoverageCalculated: [],
    filesWithNoCoverageCalculated: [],
    globalSetup: false,
    testFramework: { version: 'jest@24.8.0', configurator: 'jest@24.8.0', reporter: 'jest@24.8.0', starter: 'jest@24.8.0', autoDetected: true },
    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: '/tmp/jest_rs', regexp: /\/tmp\/jest_rs/, 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: '/tmp/jest_rs', regexp: /\/tmp\/jest_rs/, 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 },
      { pattern: '**/__tests__/**/utils.[jt]s?(x)', ignore: true, trigger: true, load: true, test: true, file: false },
      { pattern: '**/__tests__/**/*.no(spec|test).[jt]s?(x)', ignore: true, trigger: true, load: true, test: true, file: false }
    ],
    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,
    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/v18.10.0/bin/node', viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
    reportUnhandledPromises: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    runAllTestsWhenNoAffectedTests: false,
    configCode: 'module.exports = () => ({\n' +
      "  name: 'React',\n" +
      '  autoDetect: true,\n' +
      '  workers: {\n' +
      '    initial: 6,\n' +
      '    regular: 4,\n' +
      '  },\n' +
      '  delays: {\n' +
      '    // run: 1500\n' +
      '  },\n' +
      '  ignoreFileLoadingDependencyTracking: true,\n' +
      '  // files: [\n' +
      "  //   'src/**/*.js',\n" +
      '  // ],\n' +
      '  // tests: [\n' +
      "  //   '**/*.test.js',\n" +
      "  //   '!node_modules/**/*',\n" +
      '  // ],\n' +
      "  runMode: 'onsave',\n" +
      '  maxLogEntrySize: 999999,\n' +
      '});\n'
  },
  packageJSON: {
    dependencies: {
      '@ant-design/colors': '^4.0.1',
      '@ant-design/compatible': '^1.0.4',
      '@ant-design/icons': '^4.2.2',
      '@brainhubeu/react-carousel': '^1.19.26',
      '@react-pdf/renderer': '^1.6.8',
      '@tinymce/tinymce-react': '^3.5.0',
      antd: '^4.24.6',
      assert: '^2.0.0',
      axios: '^0.27.2',
      'base64-js': '^1.3.1',
      'browserify-zlib': '^0.2.0',
      buffer: '^6.0.3',
      'cep-promise': '^4.1.0',
      'crypto-js': '^3.3.0',
      dayjs: '^1.8.29',
      diff: '^5.1.0',
      'draft-js': '^0.11.7',
      'draftjs-to-html': '^0.9.1',
      'file-saver': '^2.0.2',
      history: '^4.10.1',
      'html-entities': '^2.1.0',
      'html-to-draftjs': '^1.5.0',
      'https-browserify': '^1.0.0',
      lodash: '^4.17.15',
      'lodash.clonedeep': '^4.5.0',
      md5: '^2.2.1',
      moment: '^2.24.0',
      'node-html-parser': '^5.0.0',
      numeral: '^2.0.6',
      'piwik-react-router': '^0.12.1',
      process: '^0.11.10',
      'prop-types': '^15.7.2',
      react: '^18.2.0',
      'react-app-rewired': '^2.2.1',
      'react-beautiful-dnd': '^10.1.1',
      'react-copy-to-clipboard': '^5.0.3',
      'react-cropper': '^1.3.0',
      'react-diff-component': '^0.1.5',
      'react-dom': '^18.2.0',
      'react-draft-wysiwyg': '^1.15.0',
      'react-highlight-words': '^0.16.0',
      'react-hook-thunk-reducer': '^0.2.4',
      'react-html-parser': '^2.0.2',
      'react-number-format': '^5.1.2',
      'react-pdf-html': '^1.1.4',
      'react-player': '^2.6.0',
      'react-redux': '^7.2.0',
      'react-router-dom': '^5.3.3',
      'react-scripts': '^5.0.1',
      'react-text-mask': '^5.4.3',
      'react-watermark-component': '^2.2.1',
      redux: '^4.0.5',
      'redux-thunk': '^2.3.0',
      sass: '^1.51.0',
      'stream-browserify': '^3.0.0',
      'stream-http': '^3.2.0',
      'styled-components': '^4.4.1',
      'throttle-debounce': '^2.1.0',
      url: '^0.11.0',
      util: '^0.12.4',
      uuid: '^3.4.0'
    },
    devDependencies: {
      '@babel/core': '^7.18.10',
      '@babel/eslint-parser': '^7.18.9',
      '@babel/preset-react': '^7.17.12',
      '@commitlint/cli': '^16.2.1',
      '@commitlint/config-conventional': '^16.2.1',
      '@testing-library/jest-dom': '^5.16.4',
      '@testing-library/react': '^13.3.0',
      '@testing-library/user-event': '^14.3.0',
      '@types/diff': '^5.0.2',
      '@types/jest': '^28.1.8',
      '@types/react': '^18.0.35',
      '@types/react-dom': '^18.0.11',
      '@types/react-router-dom': '^5.3.3',
      '@types/styled-components': '^5.1.26',
      'cross-env': '^7.0.3',
      eslint: '^8.21.0',
      'eslint-config-airbnb': '^19.0.4',
      'eslint-config-prettier': '^8.5.0',
      'eslint-import-resolver-alias': '^1.1.2',
      'eslint-plugin-import': '^2.26.0',
      'eslint-plugin-jest-dom': '^4.0.2',
      'eslint-plugin-jsx-a11y': '^6.5.1',
      'eslint-plugin-prettier': '^4.2.1',
      'eslint-plugin-react': '^7.29.3',
      'eslint-plugin-react-hooks': '^4.3.0',
      'eslint-plugin-testing-library': '^5.5.1',
      husky: '^7.0.4',
      jest: '^28.1.3',
      'jest-environment-jsdom': '^28.1.0',
      'jest-styled-components': '^6.3.4',
      'lint-prepush': '^2.2.1',
      'lint-staged': '^12.3.5',
      prettier: '^2.5.1',
      'react-error-overlay': '6.0.9'
    }
  },
  fs: { numberOfFiles: 1289 },
  debug: [
    '2023-05-18T15:45:33.697Z config Attempting automatic configuration for angular\n',
    '2023-05-18T15:45:33.715Z angular/cli config Angular CLI not found.\n',
    '2023-05-18T15:45:33.715Z config Finished attempting automatic configuration for angular (18ms)\n',
    '2023-05-18T15:45:33.716Z config Attempting automatic configuration for jest\n',
    '2023-05-18T15:45:34.517Z jest/config Detected Jest.\n',
    '2023-05-18T15:45:34.518Z jest/config Configured Jest.\n',
    '2023-05-18T15:45:34.518Z config Finished attempting automatic configuration for jest (802ms)\n',
    '2023-05-18T15:45:34.536Z project Wallaby Node version: v18.10.0\n',
    '2023-05-18T15:45:34.536Z project Wallaby config: <homeDir>/git/node/react/wallaby.js\n',
    '2023-05-18T15:45:35.184Z fs File system starting\n',
    '2023-05-18T15:45:37.318Z fs File system scan completed\n',
    '2023-05-18T15:45:37.366Z project File cache: <homeDir>/.vscode-server/extensions/wallabyjs.wallaby-vscode-1.0.355/projects/937751534cb9265b\n',
    '2023-05-18T15:45:37.532Z uiService Listening port 51235\n',
    '2023-05-18T15:45:37.605Z project Config file change detected, invalidating local cache\n',
    '2023-05-18T15:45:37.756Z workers Parallelism for initial run: 6, for regular run: 4\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #0\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #1\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #2\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #3\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #4\n',
    '2023-05-18T15:45:37.756Z workers Starting run worker instance #5\n',
    '2023-05-18T15:45:37.757Z workers Web server is listening at 34545\n',
    '2023-05-18T15:45:37.758Z project File cache requires some updates, waiting required files from IDE\n',
    '2023-05-18T15:45:38.135Z project Stopping process pool\n',
    '2023-05-18T15:45:38.137Z project Promoting test run to full run because of test selection changes\n',
    '2023-05-18T15:45:38.137Z project Test run started; run priority: 3\n',
    '2023-05-18T15:45:38.146Z project Running all tests\n',
    '2023-05-18T15:45:38.259Z workers Starting test run, priority: 3\n',
    '2023-05-18T15:45:38.260Z nodeRunner Starting sandbox [worker #0, session #cno0i]\n',
    '2023-05-18T15:45:38.260Z nodeRunner Preparing sandbox [worker #0, session #cno0i]\n',
    '2023-05-18T15:45:38.448Z workers Started run worker instance (delayed) #1\n',
    '2023-05-18T15:45:38.487Z workers Started run worker instance (delayed) #0\n',
    '2023-05-18T15:45:38.487Z nodeRunner Prepared sandbox [worker #0, session #cno0i]\n',
    '2023-05-18T15:45:38.488Z workers [worker #0, session #cno0i] Running tests in sandbox\n',
    '2023-05-18T15:45:38.527Z workers Started run worker instance (delayed) #3\n',
    '2023-05-18T15:45:38.644Z workers Started run worker instance (delayed) #2\n',
    '2023-05-18T15:45:38.700Z workers Started run worker instance (delayed) #5\n',
    '2023-05-18T15:45:38.742Z workers Started run worker instance (delayed) #4\n',
    '"files changed"',
    '2023-05-18T15:45:51.313Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.313Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.314Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.314Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.314Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.314Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.315Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.320Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.322Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.326Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.326Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.327Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.327Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.327Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.328Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.328Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.328Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.329Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.329Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.330Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.330Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.331Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.331Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.331Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.331Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.332Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.332Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.332Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.332Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.333Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.334Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.334Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.334Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.346Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.346Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.347Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.347Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.347Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.348Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.348Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.348Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.348Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.349Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.349Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.351Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.352Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.352Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.352Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.353Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.354Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.354Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.354Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.354Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.355Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.356Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.356Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.368Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.368Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.369Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.369Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.369Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.369Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '"files changed"',
    '2023-05-18T15:45:51.371Z extended-core File changed, running pending tests\n',
    '2023-05-18T15:45:51.371Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.371Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.372Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.384Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.384Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:51.385Z project Test run is not cancelled because cancel requester does not have enough priority to cancel the run\n',
    '2023-05-18T15:45:54.713Z workers Some long running code has been detected: one of your files is taking more than 5000ms to execute.\n' +
      'Execution of the following files has started but has not finished:\n' +
      '- test/setupTests.js\n' +
      '- src/components/authentication/Authentication.js\n' +
      '- src/services/apis/ApiModel.js\n' +
      '- src/services/apis/GenericFetch.js\n' +
      'Try commenting out the test or excluding the test file from the `tests` list in your wallaby config,\n' +
      'and restarting wallaby to make sure that it is this test/file causing the issue and not something else.\n' +
      'Pinging test runner sandbox...\n',
    '2023-05-18T15:45:54.913Z workers The sandbox is not responsive. Check for possibly recently introduced infinite loops.\n',
    '2023-05-18T15:46:33.902Z workers Scheduling Jest Test Run (cno0i): 2023-05-18T15:45:40.217Z\n',
    '2023-05-18T15:46:39.648Z workers [cno0i] Loaded unknown number of test(s)\n',
    '2023-05-18T15:46:39.662Z workers Sandbox is responsive. The issue may be asynchronous in nature (for example, a missing callback).\n',
    '"tests executed"',
    '2023-05-18T15:46:54.594Z workers [cno0i] Run 16 test(s), skipped 0 test(s)\n',
    '2023-05-18T15:46:54.594Z workers Jest Test Run Complete (cno0i): 2023-05-18T15:46:54.425Z\n',
    '2023-05-18T15:46:54.596Z workers [cno0i] Sandbox is responsive, closing it\n',
    '2023-05-18T15:46:54.598Z project Test run finished\n',
    '2023-05-18T15:46:54.598Z project Processed console.log entries\n',
    '2023-05-18T15:46:54.599Z project Processed loading sequences\n',
    '2023-05-18T15:46:54.601Z project Processed executed tests\n',
    '2023-05-18T15:46:54.703Z project Processed code coverage\n',
    '2023-05-18T15:46:54.929Z project Test run result processed and sent to IDE\n',
    '2023-05-18T15:46:55.053Z project Test run started; run priority: 2\n',
    '2023-05-18T15:46:55.054Z testTask Test files from affected: 1, from deleted or manually requested: 0, from recently changed: 0, from loaded by: 0, from failing: 1\n',
    '2023-05-18T15:46:55.055Z testTask Running only selected or not excluded tests\n',
    '2023-05-18T15:46:55.087Z workers Starting test run, priority: 2\n',
    '2023-05-18T15:46:55.087Z nodeRunner Starting sandbox [worker #0, session #lw6sc]\n',
    '2023-05-18T15:46:55.087Z nodeRunner Preparing sandbox [worker #0, session #lw6sc]\n',
    '2023-05-18T15:46:55.087Z nodeRunner Prepared sandbox [worker #0, session #lw6sc]\n',
    '2023-05-18T15:46:55.087Z workers [worker #0, session #lw6sc] Running tests in sandbox\n',
    '2023-05-18T15:47:01.121Z workers Scheduling Jest Test Run (lw6sc): 2023-05-18T15:46:55.111Z\n',
    '2023-05-18T15:47:01.473Z workers [lw6sc] Loaded unknown number of test(s)\n',
    '"tests executed"',
    '2023-05-18T15:47:16.343Z workers [lw6sc] Test executed: \n',
    '2023-05-18T15:47:16.479Z workers [lw6sc] Run 14 test(s), skipped 0 test(s)\n',
    '2023-05-18T15:47:16.479Z workers Jest Test Run Complete (lw6sc): 2023-05-18T15:47:16.333Z\n',
    '2023-05-18T15:47:16.480Z workers [lw6sc] Sandbox is responsive, closing it\n',
    '2023-05-18T15:47:16.482Z project Test run finished\n',
    '2023-05-18T15:47:16.485Z project Processed console.log entries\n',
    '2023-05-18T15:47:16.485Z project Processed loading sequences\n',
    '2023-05-18T15:47:16.486Z project Processed executed tests\n',
    '2023-05-18T15:47:16.537Z project Processed code coverage\n',
    '2023-05-18T15:47:16.709Z project Test run result processed and sent to IDE\n',
    '2023-05-18T15:49:30.389Z extended-core File changed, running pending tests\n',
    '2023-05-18T15:49:30.411Z project Promoting test run to full run because of test selection changes\n',
    '2023-05-18T15:49:30.411Z project Test run started; run priority: 3\n',
    '2023-05-18T15:49:30.412Z project Running all tests\n',
    '2023-05-18T15:49:30.475Z workers Starting test run, priority: 3\n',
    '2023-05-18T15:49:30.476Z workers Distributing tests between 6 workers\n',
    '2023-05-18T15:49:30.477Z workers Running tests in parallel\n',
    '2023-05-18T15:49:30.478Z nodeRunner Starting sandbox [worker #0, session #47aqz]\n',
    '2023-05-18T15:49:30.478Z nodeRunner Starting sandbox [worker #1, session #829zn]\n',
    '2023-05-18T15:49:30.478Z nodeRunner Preparing sandbox [worker #0, session #47aqz]\n',
    '2023-05-18T15:49:30.478Z nodeRunner Preparing sandbox [worker #1, session #829zn]\n',
    '2023-05-18T15:49:30.479Z nodeRunner Prepared sandbox [worker #0, session #47aqz]\n',
    '2023-05-18T15:49:30.479Z nodeRunner Prepared sandbox [worker #1, session #829zn]\n',
    '2023-05-18T15:49:30.479Z workers [worker #0, session #47aqz] Running tests in sandbox\n',
    '2023-05-18T15:49:30.499Z workers [worker #1, session #829zn] Running tests in sandbox\n',
    '2023-05-18T15:49:37.579Z workers Scheduling Jest Test Run (47aqz): 2023-05-18T15:49:30.551Z\n',
    '2023-05-18T15:49:37.936Z workers [47aqz] Loaded unknown number of test(s)\n',
    '"tests executed"',
    '2023-05-18T15:49:46.655Z workers [829zn] Run 7 test(s), skipped 0 test(s)\n',
    '2023-05-18T15:49:46.655Z workers Jest Test Run Complete (829zn): 2023-05-18T15:49:46.571Z\n',
    '2023-05-18T15:49:46.657Z workers [829zn] Sandbox is responsive, closing it\n',
    '"tests executed"',
    '2023-05-18T15:49:51.432Z workers [47aqz] Run 16 test(s), skipped 0 test(s)\n',
    '2023-05-18T15:49:51.433Z workers Jest Test Run Complete (47aqz): 2023-05-18T15:49:51.333Z\n',
    '2023-05-18T15:49:51.434Z workers [47aqz] Sandbox is responsive, closing it\n',
    '2023-05-18T15:49:51.434Z workers Merging parallel test run results\n',
    '2023-05-18T15:49:51.444Z project Test run finished\n',
    '2023-05-18T15:49:51.445Z project Processed console.log entries\n',
    '2023-05-18T15:49:51.445Z project Processed loading sequences\n',
    '2023-05-18T15:49:51.445Z project Processed executed tests\n',
    '2023-05-18T15:49:51.492Z project Processed code coverage\n',
    '2023-05-18T15:49:51.637Z project Test run result processed and sent to IDE\n',
  ]
}
NikGovorov commented 1 year ago

We've created a sample repo, but unfortunately, we were unable to reproduce the issue there. Could you please try the repo and see if you can reproduce the issue?

Please take note that we had to modify your config in order to resolve the ambiguity between the files and tests patterns.

‍​[Info]​ Started Wallaby.js Core v1.0.1423
​[Info]​ Wallaby App (realtime reports) is available at: http://localhost:51245
​​[Error] File/pattern src/Issue.test.js is specified in the files list but also found in the tests list: **/*.test.js.
​​
​​[Error]   If it's a test, make sure to exclude it from the files list, for example by adding { pattern: '**/*.test.js', ignore: true } to the files list.
​​
​​[Error]   If it's not a test, remove it from the tests list.​​
​​[Error] No files with tests found, check your tests list patterns.​​
​[Info]​ Can't determine tests to run for the change.
​[Info]​ To run all tests when can not determine tests to run, use `runAllTestsWhenNoAffectedTests: true` configuration option.
Noriller commented 1 year ago

Same thing.

But one interesting thing is the wallaby.js.

My current one is as follows:

module.exports = () => ({
  name: 'React',
  autoDetect: true,
  workers: {
    initial: 6,
    regular: 4,
  },
  delays: {
    // run: 1500
  },
  ignoreFileLoadingDependencyTracking: true,
  // files: [
  //   'src/**/*.js',
  // ],
  // tests: [
  //   '**/*.test.js',
  //   '!node_modules/**/*',
  // ],
  runMode: 'onsave',
  maxLogEntrySize: 999999,
});

Did the commented out configs were actually applied? (In any case, both and even deleting the file had the same effect)

NikGovorov commented 1 year ago

Sorry, I hadn't noticed that files and tests were commented out in the original config. Ignore them. How do you reproduce the issue in the sample repo? I've tried to simply start Wallaby and change the file, everything works perfectly well for me(natively on Windows and in WSL).

image

Noriller commented 1 year ago

I can see that, I opened it on my personal computer, this one with Ubuntu and it worked perfectly fine.

I'll try checking some things on the other one and maybe I can find out something.

Noriller commented 1 year ago

So, I've tried again at work and it started working (the example).

Last time I tried the example I couldn't make it work with our internal mirror of npm, then I tried bypassing and using the npm mirror.

I think it's related, but not sure why or how.

smcenlly commented 1 year ago

Does your internal mirror of npm limit the versions of dependencies that are available? If so, this may be the cause of your problem if you are using old or incompatible versions of dependencies.

Next time you have the problem, you could send us your package-lock.json or yarn.lock and that would help us work out why. Also, next time it occurs, try cloning to a fresh directory and install the dependencies by bypassing the internal mirror. If that works, you can diff the files to determine what's different, which should help identify the cause.

smcenlly commented 1 year ago

I'm going to close this issue for now because I don't think any further action is required from us. If/when you get the problem again, please either reply to this issue (and we can re-open it) or create a new issue.

If you work out the root cause after examining your dependencies when you have the problem again, please let us know what the cause is; we may be able to check for it to help others in the future.