wallabyjs / public

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

Jest. No diff in error report for .isStrictEqual(). For .isEqual() exists. #2837

Closed korniychuk closed 3 years ago

korniychuk commented 3 years ago

Issue description or question

Error report from: expect(res1).toStrictEqual(exp1); doesn't provide so useful Show difference button. expect(res1).toEqual(exp1); works fine, but my project uses the strict version of the operator.

I would be very grateful if you would correct this error if it is in WallabyJS. Or suggest any ideas about fixing the problem if you think it is on my side.

Video Demo: https://cln.sh/YOxYJD

Thank you very much in advance!

Ankor 2021-10-18 at 15 46 08@2x

Wallaby diagnostics report

{
  editorVersion: 'WebStorm 2021.2.2',
  pluginVersion: '1.0.225',
  editorType: 'IntelliJ',
  osVersion: 'darwin 20.3.0',
  nodeVersion: 'v16.4.2',
  coreVersion: '1.0.1164',
  checksum: 'ZWRhMjFkMjRhNGNhMmE5YzZjMGVjMTA4Y2ZjNTJjYjIsMTY1Njg5MjgwMDAwMCww',
  config: {
    diagnostics: {
      jest: {
        config: {
          configs: [
            {
              automock: false,
              cache: true,
              cacheDirectory: '/private/var/folders/zl/kxz7lm0j0kg_91w5t07ccr4m0000gn/T/jest_dx',
              clearMocks: false,
              coveragePathIgnorePatterns: [ '/node_modules/' ],
              cwd: '<rootDir>',
              dependencyExtractor: undefined,
              detectLeaks: false,
              detectOpenHandles: false,
              displayName: undefined,
              errorOnDeprecated: false,
              extensionsToTreatAsEsm: [],
              extraGlobals: [],
              filter: undefined,
              forceCoverageMatch: [],
              globalSetup: undefined,
              globalTeardown: undefined,
              globals: { 'ts-jest': { isolatedModules: false } },
              haste: { computeSha1: false, enableSymlinks: false, forceNodeFilesystemAPI: false, throwOnModuleCollision: false },
              injectGlobals: true,
              moduleDirectories: [ 'node_modules' ],
              moduleFileExtensions: [ 'js', 'json', 'ts' ],
              moduleLoader: undefined,
              moduleNameMapper: [
                [ '^@lib(.*)', '<rootDir>/libs$1' ],
                [ '^@src(.*)', '<rootDir>/src$1' ]
              ],
              modulePathIgnorePatterns: [],
              modulePaths: undefined,
              name: '03cfd1651a14123f09ec4c66cf8b6d8e',
              prettierPath: 'prettier',
              resetMocks: false,
              resetModules: false,
              resolver: undefined,
              restoreMocks: false,
              rootDir: '<rootDir>',
              roots: [ '<rootDir>/apps', '<rootDir>/libs', '<rootDir>/src' ],
              runner: '<rootDir>/node_modules/jest-runner/build/index.js',
              setupFiles: [ '<rootDir>/configs/jest-setup.ts' ],
              setupFilesAfterEnv: [ '<rootDir>/node_modules/jest-extended/dist/index.js' ],
              skipFilter: false,
              skipNodeResolution: undefined,
              slowTestThreshold: 5,
              snapshotFormat: undefined,
              snapshotResolver: undefined,
              snapshotSerializers: [],
              testEnvironment: '<rootDir>/node_modules/jest-environment-node/build/index.js',
              testEnvironmentOptions: {},
              testLocationInResults: false,
              testMatch: [],
              testPathIgnorePatterns: [ '/node_modules/' ],
              testRegex: [ '\\.spec\\.ts$' ],
              testRunner: '<rootDir>/node_modules/jest-circus/runner.js',
              testURL: 'http://localhost',
              timers: 'real',
              transform: [ [ '^.+\\.(t|j)s$', '<rootDir>/node_modules/ts-jest/dist/index.js', {} ] ],
              transformIgnorePatterns: [ '/node_modules/', '\\.pnp\\.[^\\/]+$' ],
              unmockedModulePathPatterns: undefined,
              watchPathIgnorePatterns: []
            }
          ],
          globalConfig: {
            bail: 0,
            changedFilesWithAncestor: false,
            changedSince: undefined,
            collectCoverage: false,
            collectCoverageFrom: [ '**/*.(t|j)s' ],
            collectCoverageOnlyFrom: undefined,
            coverageDirectory: '/Users/volumes/code/my-proj/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: 11,
            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: '<rootDir>',
            runTestsByPath: false,
            silent: undefined,
            skipFilter: false,
            snapshotFormat: undefined,
            testFailureExitCode: 1,
            testNamePattern: undefined,
            testPathPattern: '',
            testResultsProcessor: undefined,
            testSequencer: '<rootDir>/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: [ 'apps', 'libs', 'src' ],
            watchPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/' ],
            testPathIgnorePatterns: [ '/node_modules/', '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/' ],
            testMatch: [],
            testRegex: [ '\\.spec\\.ts$' ]
          }
        }
      }
    },
    testFramework: { version: 'jest@24.8.0', configurator: 'jest@24.8.0', reporter: 'jest@24.8.0', starter: 'jest@24.8.0', autoDetected: true },
    filesWithCoverageCalculated: [ '**/*.(t|j)s' ],
    filesWithNoCoverageCalculated: [],
    globalSetup: false,
    micromatch: true,
    files: [
      { pattern: '/node_modules/', regexp: /\/node_modules\//, ignore: true, trigger: true, load: true },
      { pattern: '\\./dist/|\\./build/|\\./coverage/|\\./git/|/\\..+/', regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\.\/git\/|\/\..+\//, ignore: true, trigger: true, load: true },
      { pattern: '**/**', ignore: false, trigger: true, load: true, order: 1 },
      { pattern: 'apps/**', ignore: false, trigger: true, load: true, order: 2 },
      { pattern: 'libs/**', ignore: false, trigger: true, load: true, order: 3 },
      { pattern: 'src/**', ignore: false, trigger: true, load: true, order: 4 },
      { pattern: '\\.spec\\.ts$', regexp: /\.spec\.ts$/, 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/|\\./git/|/\\..+/',
        regexp: /\.\/dist\/|\.\/build\/|\.\/coverage\/|\.\/git\/|\/\..+\//,
        ignore: true,
        trigger: true,
        load: true,
        test: true
      },
      { pattern: '\\.spec\\.ts$', regexp: /\.spec\.ts$/, ignore: false, trigger: true, load: true, test: true, order: 5 }
    ],
    runAllTestsInAffectedTestFile: false,
    updateNoMoreThanOneSnapshotPerTestFileRun: false,
    addModifiedTestFileToExclusiveTestRun: true,
    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,
    mapConsoleMessagesStackTrace: false,
    extensions: {},
    env: {
      type: 'node',
      params: {},
      runner: '/Users/volumes/storage/system/.nvm/versions/node/v16.4.2/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#-268657103'
  },
  packageJSON: {
    dependencies: {
      '@nestjs/common': '~8.0.6',
      '@nestjs/core': '~8.0.6',
      '@nestjs/platform-express': '~8.0.6',
      '@nestjs/swagger': '~5.1.0',
      '@nestjs/typeorm': '~8.0.2',
      '@nestjsx/crud': '~4.6.2',
      '@nestjsx/crud-typeorm': '~4.6.2',
      '@my-proj/api-entity-ref': '~1.2.2',
      '@my-proj/typed-node-env': '~1.0.5',
      '@my-proj/typeorm-postgres-camelcase-naming-strategy': '~1.0.18',
      async: '~3.2.1',
      'binance-api-node': '~0.11.5',
      ccxt: '~1.52.61',
      ccxws: '~0.47.0',
      'class-transformer': '~0.4.0',
      'class-validator': '~0.13.1',
      dayjs: '~1.10.7',
      'deep-freeze': '~0.0.1',
      'escape-string-regexp': '~4.0.0',
      express: '~4.17.1',
      got: '~11.8.2',
      lodash: '~4.17.21',
      'module-alias': '~2.2.2',
      'node-binance-api': '~0.13.0',
      pg: '~8.7.1',
      ping: '~0.4.1',
      pluralize: '~8.0.0',
      'pusher-js': '5.1.1',
      'reconnecting-websocket': '~4.4.0',
      'reflect-metadata': '~0.1.13',
      rimraf: '~3.0.2',
      rxjs: '~7.3.0',
      'swagger-ui-express': '~4.1.6',
      table: '~6.7.1',
      typeorm: '~0.2.37',
      'typescript-memoize': '~1.0.1',
      'utility-types': '~3.10.0',
      uuid: '~8.3.2',
      ws: '~7.5.5',
      yargs: '~17.1.1'
    },
    devDependencies: {
      '@nestjs/cli': '~8.1.1',
      '@nestjs/schematics': '~8.0.3',
      '@nestjs/testing': '~8.0.6',
      '@types/async': '~3.2.8',
      '@types/deep-freeze': '~0.1.2',
      '@types/express': '~4.17.13',
      '@types/jest': '~27.0.1',
      '@types/lodash': '~4.14.173',
      '@types/module-alias': '~2.0.1',
      '@types/node': '~16.9.3',
      '@types/node-fetch': '~2.5.11',
      '@types/pg': '~8.6.1',
      '@types/ping': '~0.2.1',
      '@types/pluralize': '~0.0.29',
      '@types/semaphore': '~1.1.1',
      '@types/supertest': '~2.0.11',
      '@types/table': '~6.3.2',
      '@types/uuid': '~8.3.1',
      '@types/ws': '~7.4.7',
      '@types/yargs': '~17.0.2',
      '@typescript-eslint/eslint-plugin': '~4.31.2',
      '@typescript-eslint/parser': '~4.31.2',
      '@my-proj/eslint-plugin-api-entity-ref': '~1.0.4',
      eslint: '~7.32.0',
      'eslint-config-airbnb-base': '~14.2.1',
      'eslint-import-resolver-typescript': '~2.5.0',
      'eslint-plugin-filenames': '~1.3.2',
      'eslint-plugin-import': '~2.24.2',
      'eslint-plugin-jest': '~24.4.2',
      'eslint-plugin-lodash': '~7.3.0',
      'eslint-plugin-optimize-regex': '~1.2.0',
      'eslint-plugin-promise': '~5.1.0',
      'eslint-plugin-tsdoc': '~0.2.14',
      'eslint-plugin-unicorn': '~36.0.0',
      husky: '~7.0.2',
      jest: '~27.2.0',
      'jest-extended': '~0.11.5',
      'rxjs-marbles': '~7.0.1',
      supertest: '~6.1.6',
      'ts-jest': '~27.0.5',
      'ts-loader': '~9.2.5',
      'ts-node': '~10.2.1',
      'tsc-watch': '~4.5.0',
      typescript: '~4.4.3'
    }
  },
  fs: { numberOfFiles: 509 },
  debug: [
    '2021-10-18T12:49:16.411Z angular/cli config Angular CLI not found.\n',
    '2021-10-18T12:49:16.473Z jest/config Detected Jest.\n',
    '2021-10-18T12:49:16.473Z jest/config Configured Jest.\n',
    '2021-10-18T12:49:16.475Z project Wallaby Node version: v16.4.2\n',
    '2021-10-18T12:49:16.475Z project Wallaby config: <rootDir>/auto.detect\n',
    '2021-10-18T12:49:19.047Z project File cache: <homeDir>/Library/Caches/JetBrains/WebStorm2021.2/wallaby/projects/1d0e271045827153\n',
    '2021-10-18T12:49:19.129Z uiService Listening port 51235\n',
    '2021-10-18T12:49:19.132Z project package.json file change detected, invalidating local cache\n',
    '2021-10-18T12:49:19.143Z workers Parallelism for initial run: 10, for regular run: 5\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #0\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #1\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #2\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #3\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #4\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #5\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #6\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #7\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #8\n',
    '2021-10-18T12:49:19.143Z workers Starting run worker instance #9\n',
    '2021-10-18T12:49:19.144Z workers Web server is listening at 53432\n',
    '2021-10-18T12:49:19.144Z project File cache requires some updates, waiting required files from IDE\n',
    '2021-10-18T12:49:19.354Z workers Started run worker instance (delayed) #3\n',
    '2021-10-18T12:49:19.355Z workers Started run worker instance (delayed) #2\n',
    '2021-10-18T12:49:19.355Z workers Started run worker instance (delayed) #0\n',
    '2021-10-18T12:49:19.355Z workers Started run worker instance (delayed) #1\n',
    '2021-10-18T12:49:19.356Z workers Started run worker instance (delayed) #6\n',
    '2021-10-18T12:49:19.360Z workers Started run worker instance (delayed) #4\n',
    '2021-10-18T12:49:19.361Z project Stopping process pool\n',
    '2021-10-18T12:49:19.362Z project Promoting test run to full run because of test selection changes\n',
    '2021-10-18T12:49:19.362Z project Test run started; run priority: 3\n',
    '2021-10-18T12:49:19.364Z project Running all tests\n',
    '2021-10-18T12:49:19.371Z workers Starting test run, priority: 3\n',
    '2021-10-18T12:49:19.371Z nodeRunner Starting sandbox [worker #0, session #qgbv0]\n',
    '2021-10-18T12:49:19.371Z nodeRunner Preparing sandbox [worker #0, session #qgbv0]\n',
    '2021-10-18T12:49:19.371Z nodeRunner Prepared sandbox [worker #0, session #qgbv0]\n',
    '2021-10-18T12:49:19.372Z workers [worker #0, session #qgbv0] Running tests in sandbox\n',
    '2021-10-18T12:49:19.380Z workers Started run worker instance (delayed) #5\n',
    '2021-10-18T12:49:19.386Z workers Started run worker instance (delayed) #7\n',
    '2021-10-18T12:49:19.393Z workers Started run worker instance (delayed) #8\n',
    '2021-10-18T12:49:19.405Z workers Started run worker instance (delayed) #9\n',
    '2021-10-18T12:49:25.388Z workers Scheduling Jest Test Run (qgbv0): 2021-10-18T12:49:19.575Z\n',
    '2021-10-18T12:49:25.429Z workers [qgbv0] Loaded unknown number of test(s)\n',
    '2021-10-18T12:49:25.429Z workers [qgbv0] Test executed: Taking a snapshot of empty LOB\n',
    '2021-10-18T12:49:25.429Z workers [qgbv0] Test executed: Simple filling and taking a snapshot\n',
    '2021-10-18T12:49:25.429Z workers [qgbv0] Test executed: Clearing LOB.\n' +
    '2021-10-18T12:49:25.429Z workers [qgbv0] Test executed: Add a bid & an ask to the tops.\n' +
      '        WHEN: snapshot2 is applied; THEN: .takeSnapshot() again should return new best prices at the top\n',
    '2021-10-18T12:49:25.430Z workers [qgbv0] Test executed: Add a bid & an ask to the bottoms.\n' +
      '        WHEN: snapshot2 is applied; THEN: .takeSnapshot() again should return new the worst prices at the bottom\n',
    '2021-10-18T12:49:25.435Z workers [qgbv0] Run 5 test(s), skipped 0 test(s)\n',
    '2021-10-18T12:49:25.435Z workers Jest Test Run Complete (qgbv0): 2021-10-18T12:49:25.387Z\n',
    '2021-10-18T12:49:25.436Z workers [qgbv0] Sandbox is responsive, closing it\n',
    '2021-10-18T12:49:25.437Z project Test run finished\n',
    '2021-10-18T12:49:25.437Z project Processed console.log entries\n',
    '2021-10-18T12:49:25.437Z project Processed loading sequences\n',
    '2021-10-18T12:49:25.437Z project Processed executed tests\n',
    '2021-10-18T12:49:25.441Z project Processed code coverage\n',
    '2021-10-18T12:49:25.500Z project Test run result processed and sent to IDE\n',
  ]
}
smcenlly commented 3 years ago

Thanks for letting us know about your issue, and for the video, diagnostics report, etc.

This was a problem with Wallaby; it was not handling toStrictEqual but has been updated to now also handle this expect function.

Wallaby core to v1.0.1165+ supports the toStrictEqual function. Wallaby should automatically upgrade for you but if it does not, you can close all instances of WebStorm and when you next restart Wallaby, it will check for and download the latest version.

korniychuk commented 3 years ago

I restarted WallabyJS ane it become working! @smcenlly Thank you for the fix and the fast response! 🙏 🦾