wallabyjs / public

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

Cannot run all tests in my project, reset/clear filter of tests not working? #2458

Closed DHFW closed 4 years ago

DHFW commented 4 years ago

I have 306 tests in my project (all run fine with Jest from command). I have played with the filtering tests feature but now I cannot run all tests again (no .only or .fit applicable). Jest runs them all.

Steps I tried:

Wallaby diagnostics report

{ editorVersion: '1.46.1',
  pluginVersion: '1.0.211',
  editorType: 'VSCode',
  osVersion: 'darwin 19.4.0',
  nodeVersion: 'v10.14.1',
  coreVersion: '1.0.919',
  config:
   { diagnostics:
      { jest:
         { config:
            { configs:
               [ { automock: false,
                   browser: false,
                   cache: true,
                   cacheDirectory: '/private/var/folders/hr/h7cbtm1573b90w1rtwzv6ksh0000gn/T/jest_dx',
                   clearMocks: false,
                   coveragePathIgnorePatterns: [ '/node_modules/' ],
                   cwd: '<homeDir>/Projects/BE/api',
                   dependencyExtractor: undefined,
                   detectLeaks: undefined,
                   detectOpenHandles: undefined,
                   displayName: undefined,
                   errorOnDeprecated: false,
                   extraGlobals: [],
                   filter: undefined,
                   forceCoverageMatch: [],
                   globalSetup: undefined,
                   globalTeardown: undefined,
                   globals: {},
                   haste: { computeSha1: false, providesModuleNodeModules: [], throwOnModuleCollision: false },
                   moduleDirectories: [ 'node_modules' ],
                   moduleFileExtensions: [ 'ts', 'js', 'json', 'node' ],
                   moduleLoader: undefined,
                   moduleNameMapper: [],
                   modulePathIgnorePatterns: [],
                   modulePaths: [ '<homeDir>/Projects/BE/api/src' ],
                   name: 'e9ede41b0e2665ccbfbc05f1aa2ed51c',
                   prettierPath: 'prettier',
                   resetMocks: false,
                   resetModules: false,
                   resolver: undefined,
                   restoreMocks: false,
                   rootDir: '<homeDir>/Projects/BE/api',
                   roots: [ '<homeDir>/Projects/BE/api/src' ],
                   runner: 'jest-runner',
                   setupFiles: [],
                   setupFilesAfterEnv: [],
                   skipFilter: false,
                   skipNodeResolution: undefined,
                   snapshotResolver: undefined,
                   snapshotSerializers: [],
                   testEnvironment: '<homeDir>/Projects/BE/api/node_modules/jest-environment-node/build/index.js',
                   testEnvironmentOptions: {},
                   testLocationInResults: false,
                   testMatch: [],
                   testPathIgnorePatterns: [ '/node_modules/' ],
                   testRegex: [ '(/__tests__/.*|(\\.|/)(test))\\.tsx?$' ],
                   testRunner: '<homeDir>/Projects/BE/api/node_modules/jest-jasmine2/build/index.js',
                   testURL: 'http://localhost',
                   timers: 'real',
                   transform: [ [ '^.+\\.ts?$', '<homeDir>/Projects/BE/api/node_modules/ts-jest/dist/index.js', {} ] ],
                   transformIgnorePatterns: [ '/node_modules/' ],
                   unmockedModulePathPatterns: undefined,
                   watchPathIgnorePatterns: [] } ],
              globalConfig:
               { bail: 0,
                 changedFilesWithAncestor: false,
                 changedSince: undefined,
                 collectCoverage: false,
                 collectCoverageFrom: [],
                 collectCoverageOnlyFrom: undefined,
                 coverageDirectory: '<homeDir>/Projects/BE/api/coverage',
                 coverageProvider: 'babel',
                 coverageReporters: [ 'json', 'text', 'lcov', 'clover' ],
                 coverageThreshold: undefined,
                 detectLeaks: undefined,
                 detectOpenHandles: undefined,
                 enabledTestsMap: undefined,
                 errorOnDeprecated: false,
                 expand: false,
                 filter: undefined,
                 findRelatedTests: false,
                 forceExit: false,
                 globalSetup: undefined,
                 globalTeardown: undefined,
                 json: false,
                 lastCommit: false,
                 listTests: undefined,
                 logHeapUsage: false,
                 maxConcurrency: 5,
                 maxWorkers: 11,
                 noSCM: undefined,
                 noStackTrace: false,
                 nonFlagArgs: undefined,
                 notify: false,
                 notifyMode: 'failure-change',
                 onlyChanged: false,
                 onlyFailures: false,
                 outputFile: undefined,
                 passWithNoTests: undefined,
                 projects: [],
                 replname: undefined,
                 reporters: undefined,
                 rootDir: '<homeDir>/Projects/BE/api',
                 runTestsByPath: false,
                 silent: undefined,
                 skipFilter: false,
                 testFailureExitCode: 1,
                 testNamePattern: undefined,
                 testPathPattern: '',
                 testResultsProcessor: undefined,
                 testSequencer: '<homeDir>/Projects/BE/api/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: [ 'src' ],
                 watchPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|/\\.cache/|/\\.idea/|/\\.vscode/|/\\.git/|/\\.gitlab/' ],
                 testPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|/\\.cache/|/\\.idea/|/\\.vscode/|/\\.git/|/\\.gitlab/' ],
                 testMatch: [],
                 testRegex: [ '(/__tests__/.*|(\\.|/)(test))\\.tsx?$' ] } } } },
     testFramework: { version: 'jest@24.8.0', configurator: 'jest@24.8.0', reporter: 'jest@24.8.0', starter: 'jest@24.8.0', autoDetected: true },
     filesWithCoverageCalculated: [],
     globalSetup: false,
     micromatch: true,
     files:
      [ { pattern: '/node_modules/', regexp: /\/node_modules\//, ignore: true, trigger: true, load: true },
        { pattern: '\\./dist/|\\./build/|\\./coverage/|/\\.cache/|/\\.idea/|/\\.vscode/|/\\.git/|/\\.gitlab/',
          regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\/\.cache\/|\/\.idea\/|\/\.vscode\/|\/\.git\/|\/\.gitlab\//,
          ignore: true,
          trigger: true,
          load: true },
        { pattern: 'src/**', ignore: false, trigger: true, load: true, order: 1 },
        { pattern: '(/__tests__/.*|(\\.|/)(test))\\.tsx?$', regexp: /(\/__tests__\/.*|(\.|\/)(test))\.tsx?$/, ignore: true, trigger: true, load: true } ],
     tests:
      [ { pattern: '/node_modules/', regexp: /\/node_modules\//, ignore: true, trigger: true, load: true, test: true },
        { pattern: '\\./dist/|\\./build/|\\./coverage/|/\\.cache/|/\\.idea/|/\\.vscode/|/\\.git/|/\\.gitlab/',
          regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\/\.cache\/|\/\.idea\/|\/\.vscode\/|\/\.git\/|\/\.gitlab\//,
          ignore: true,
          trigger: true,
          load: true,
          test: true },
        { pattern: '(/__tests__/.*|(\\.|/)(test))\\.tsx?$', regexp: /(\/__tests__\/.*|(\.|\/)(test))\.tsx?$/, ignore: false, trigger: true, load: true, test: true, order: 2 } ],
     filesWithNoCoverageCalculated: [],
     runAllTestsInAffectedTestFile: false,
     updateNoMoreThanOneSnapshotPerTestFileRun: false,
     compilers: {},
     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/',
        ignoreCoverageForFile: '__REGEXP /ignore file coverage/',
        commentAutoLog: '?',
        testFileSelection: { include: '__REGEXP /file\\.only/', exclude: '__REGEXP /file\\.skip/' } },
     automaticTestFileSelection: true,
     runSelectedTestsOnly: false,
     extensions: {},
     env: { type: 'node', params: {}, runner: '<homeDir>/.nvm/versions/node/v10.14.1/bin/node', viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
     reportUnhandledPromises: true,
     slowTestThreshold: 75,
     lowCoverageThreshold: 80,
     loose: true,
     configCode: 'auto.detect#1941391399' },
  packageJSON:
   { dependencies:
      { '@elastic/elasticsearch': '7.3.0',
        '@gql2ts/from-schema': '1.10.1',
        'apollo-fetch': '0.7.0',
        'apollo-server': '2.15.0',
        'apollo-server-errors': '2.4.1',
        'apollo-server-express': '2.15.0',
        axios: '0.19.2',
        'babel-plugin-import-graphql': '2.7.0',
        'big-number': '2.0.0',
        bl: '1.0.2',
        'body-parser': '1.19.0',
        'cls-hooked': '4.2.2',
        concurrently: '5.2.0',
        'cookie-parser': '1.4.5',
        cors: '2.8.5',
        'date-fns': '2.2.1',
        'dev-null': '0.1.1',
        dotenv: '8.2.0',
        errorhandler: '1.5.1',
        express: '4.17.1',
        'express-session': '1.16.2',
        'form-data': '3.0.0',
        glob: '7.1.6',
        graphql: '14.5.6',
        'graphql-resolvers': '0.4.2',
        'graphql-tools': '4.0.5',
        'guid-typescript': '1.0.9',
        knex: '0.21.1',
        lodash: '4.17.15',
        lowdb: '1.0.0',
        marked: '0.7.0',
        'merge-graphql-schemas': '1.7.8',
        mkdirp: '0.5.1',
        morgan: '1.10.0',
        mssql: '6.2.0',
        nodemailer: '6.4.10',
        objection: '2.2.0',
        'objection-graphql': '0.4.5',
        'promise-all': '1.0.0',
        request: '2.88.2',
        'request-promise': '4.2.5',
        'request-promise-native': '1.0.8',
        shortid: '2.2.15',
        'tough-cookie': '2.5.0',
        winston: '3.2.1',
        'winston-elasticsearch': '0.7.13' },
     devDependencies:
      { '@babel/cli': '7.10.1',
        '@babel/core': '7.10.2',
        '@babel/node': '7.10.1',
        '@babel/plugin-proposal-class-properties': '7.10.1',
        '@babel/plugin-proposal-decorators': '7.10.1',
        '@babel/plugin-proposal-object-rest-spread': '7.10.1',
        '@babel/preset-env': '7.10.2',
        '@babel/preset-typescript': '7.10.1',
        '@types/bl': '2.1.0',
        '@types/body-parser': '1.19.0',
        '@types/cls-hooked': '4.3.0',
        '@types/cookie-parser': '1.4.2',
        '@types/dotenv': '8.2.0',
        '@types/errorhandler': '0.0.32',
        '@types/express': '4.16.0',
        '@types/express-session': '1.17.0',
        '@types/glob': '7.1.2',
        '@types/graphql': '14.5.0',
        '@types/jest': '26.0.0',
        '@types/lodash': '4.14.155',
        '@types/lowdb': '1.0.6',
        '@types/marked': '^0.6.3',
        '@types/mkdirp': '0.5.2',
        '@types/morgan': '1.9.1',
        '@types/node': '14.0.13',
        '@types/request-promise': '4.1.46',
        '@types/request-promise-native': '1.0.17',
        '@types/rimraf': '^2.0.2',
        '@types/shortid': '0.0.29',
        chai: '4.2.0',
        connect: '3.7.0',
        'cross-conf-env': '1.1.2',
        jest: '25.4.0',
        'ng-apimock': '1.4.9',
        nodemon: '1.19.2',
        prettier: '1.15.3',
        rimraf: '2.6.2',
        'ts-jest': '25.4.0',
        'ts-node': '8.10.2',
        tslint: '6.1.2',
        'tslint-config-airbnb': '5.11.2',
        'tslint-config-prettier': '1.18.0',
        'tslint-consistent-codestyle': '1.16.0',
        'tslint-eslint-rules': '5.4.0',
        typescript: '3.8.3' } },
  fs: { numberOfFiles: 298 },
  debug:
   [ '2020-06-24T09:39:54.286Z angular/cli config Angular CLI not found.\n',
     '2020-06-24T09:39:54.426Z jest/config Detected Jest.\n',
     '2020-06-24T09:39:54.427Z jest/config Configured Jest.\n',
     '2020-06-24T09:39:54.431Z project Wallaby Node version: v10.14.1\n',
     '2020-06-24T09:39:54.431Z project Wallaby config: <homeDir>/Projects/BE/api/auto.detect\n',
     '2020-06-24T09:39:55.442Z project File cache: <homeDir>/.vscode/extensions/wallabyjs.wallaby-vscode-1.0.211/projects/58f69c6f1b1041c2\n',
     '2020-06-24T09:39:55.457Z uiService Listening port 51235\n',
     '2020-06-24T09:39:55.465Z project package.json file change detected, invalidating local cache\n',
     '2020-06-24T09:39:55.485Z workers Parallelism for initial run: 10, for regular run: 5\n',
     '2020-06-24T09:39:55.485Z workers Starting run worker instance #0\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #1\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #2\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #3\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #4\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #5\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #6\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #7\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #8\n',
     '2020-06-24T09:39:55.486Z workers Starting run worker instance #9\n',
     '2020-06-24T09:39:55.486Z workers Web server is listening at 50421\n',
     '2020-06-24T09:39:55.487Z project File cache requires some updates, waiting required files from IDE\n',
     '2020-06-24T09:39:55.693Z project Stopping process pool\n',
     '2020-06-24T09:39:55.694Z project Test run started; run priority: 3\n',
     '2020-06-24T09:39:55.698Z project Running all tests\n',
     '2020-06-24T09:39:55.710Z workers Starting test run, priority: 3\n',
     '2020-06-24T09:39:55.710Z nodeRunner Starting sandbox [worker #0, session #bjlbb]\n',
     '2020-06-24T09:39:55.710Z nodeRunner Preparing sandbox [worker #0, session #bjlbb]\n',
     '2020-06-24T09:39:55.983Z workers Started run worker instance (delayed) #1\n',
     '2020-06-24T09:39:55.984Z workers Started run worker instance (delayed) #0\n',
     '2020-06-24T09:39:55.985Z nodeRunner Prepared sandbox [worker #0, session #bjlbb]\n',
     '2020-06-24T09:39:55.985Z workers [worker #0, session #bjlbb] Running tests in sandbox\n',
     '2020-06-24T09:39:55.989Z workers Started run worker instance (delayed) #2\n',
     '2020-06-24T09:39:55.989Z workers Started run worker instance (delayed) #3\n',
     '2020-06-24T09:39:56.028Z workers Started run worker instance (delayed) #4\n',
     '2020-06-24T09:39:56.041Z workers Started run worker instance (delayed) #5\n',
     '2020-06-24T09:39:56.058Z workers Started run worker instance (delayed) #6\n',
     '2020-06-24T09:39:56.071Z workers Started run worker instance (delayed) #8\n',
     '2020-06-24T09:39:56.071Z workers Started run worker instance (delayed) #7\n',
     '2020-06-24T09:39:56.076Z workers Started run worker instance (delayed) #9\n',
     '2020-06-24T09:40:06.911Z workers [bjlbb] Loaded unknown number of test(s)\n',
     '2020-06-24T09:40:06.911Z workers [bjlbb] Test executed: should create\n',
     '2020-06-24T09:40:07.288Z workers [bjlbb] Test executed: should work\n',
     '2020-06-24T09:40:07.548Z workers [bjlbb] Test executed: should create invoiceCollection\n',
     '2020-06-24T09:40:07.548Z workers [bjlbb] Test executed: should return correct date\n',
     '2020-06-24T09:40:07.566Z workers [bjlbb] Run 4 test(s), skipped 0 test(s)\n',
     '2020-06-24T09:40:07.567Z workers [bjlbb] Sandbox is responsive, closing it\n',
     '2020-06-24T09:40:07.568Z project Test run finished\n',
     '2020-06-24T09:40:07.569Z project Processed console.log entries\n',
     '2020-06-24T09:40:07.569Z project Processed loading sequences\n',
     '2020-06-24T09:40:07.570Z project Processed executed tests\n',
     '2020-06-24T09:40:07.575Z project Processed code coverage\n',
     '2020-06-24T09:40:07.598Z project Test run result processed and sent to IDE\n' ] }
ArtemGovorov commented 4 years ago

Thanks for providing the report. Can you please try:

DHFW commented 4 years ago

@ArtemGovorov, do you mean this:

0 failing tests, 4 passing (only executed src/services/invoices/invoices.service.test.ts)  ​Launch Coverage & Test Explorer​ | ​Search Tests​

ArtemGovorov commented 4 years ago

0 failing tests, 4 passing (only executed src/services/invoices/invoices.service.test.ts)  ​Launch Coverage & Test Explorer​ | ​Search Tests​

Yes, thanks. Looks like the src/services/invoices/invoices.service.test.ts is selected for exclusive run somehow. Have you tried to:

DHFW commented 4 years ago

Yes of course, I tried many different steps as mentioned including this. All without success. Can I hard reset something somewhere?

ArtemGovorov commented 4 years ago

@DHFW In this case, it looks like Wallaby is selecting the file for an exclusive test run automatically based on its content. Can you please try to delete the whole content of the file (leaving maybe a single simple test), to see if it helps? If it does, please either share file content with us, so we could analyse it, or try adding things back to the file gradually to find out what's causing the tool to select the file for an exclusive test run?

DHFW commented 4 years ago

@ArtemGovorov when I delete (or rename) the invoice.service.test.ts file, it does run all tests! But, when I restore the file, it only runs that file again. However, it seems after a few more trying that is works now... I don't know what it was or what helped... Thanks for the suggestions.

smcenlly commented 4 years ago

@DHFW - it's possible that your jest cache was corrupt. If you have the same problem in the future, please try the following:

  1. Stop all running Wallaby instances
  2. Clear jest cache from command line using npx jest --clearCache.
  3. Restart Wallaby