wallabyjs / public

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

Performance comments have stopped working #2595

Closed googleoryx closed 3 years ago

googleoryx commented 3 years ago

Performance comments have stopped working

Wallaby diagnostics report

{
  editorVersion: '1.52.1',
  pluginVersion: '1.0.254',
  editorType: 'VSCode',
  osVersion: 'win32 10.0.19042',
  nodeVersion: 'v12.7.0',
  coreVersion: '1.0.856',
  config: {
    files: [
      { pattern: 'src/**/*.{ts,html}', load: false, ignore: false, trigger: true, order: 1 },
      { pattern: 'test/**/*.ts', load: false, ignore: false, trigger: true, order: 2 },
      { pattern: 'test/**/*.spec.ts', ignore: true, trigger: true, load: true }
    ],
    tests: [ { pattern: 'test/utilities.spec.ts', load: false, ignore: false, trigger: true, test: true, order: 3 } ],
    env: { kind: 'chrome', type: 'browser', params: {}, viewportSize: { width: 800, height: 600 }, options: { width: 800, height: 600 }, bundle: true },
    testFramework: { version: 'jasmine@3.4.0', configurator: 'jasmine@2.1.3', reporter: 'jasmine@2.1.3', starter: 'jasmine@2.1.3' },
    diagnostics: {},
    filesWithNoCoverageCalculated: [],
    runAllTestsInAffectedTestFile: 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: {},
    reportUnhandledPromises: false,
    throwOnBeforeUnload: true,
    slowTestThreshold: 75,
    lowCoverageThreshold: 80,
    loose: true,
    configCode: 'module.exports = function (wallaby) {\n' +
      '  return {\n' +
      '    files: [\n' +
      '      { pattern: "src/**/*.{ts,html}", load: false },\n' +
      '      { pattern: "test/**/*.ts", load: false },\n' +
      '      "!test/**/*.spec.ts"\n' +
      '    ],\n' +
      '\n' +
      '    tests: [{ pattern: "test/utilities.spec.ts", load: false }],\n' +
      '\n' +
      '    postprocessor: wallaby.postprocessors.webpack(\n' +
      '      require("./webpack.config")({ production: false, tests: true }),\n' +
      '      {\n' +
      '        setupFiles: ["test/wallaby-setup.ts"]\n' +
      '      }\n' +
      '    ),\n' +
      '\n' +
      '    setup: function () {\n' +
      '      // required to trigger test loading\n' +
      '      window.__moduleBundler.loadTests();\n' +
      '    },\n' +
      '\n' +
      '    env: {\n' +
      '      kind: "chrome"\n' +
      '    },\n' +
      '\n' +
      '    testFramework: "jasmine"\n' +
      '  };\n' +
      '};\n'
  },
  packageJSON: {
    dependencies: {
      '@fortawesome/fontawesome-svg-core': '^1.2.28',
      '@fortawesome/free-brands-svg-icons': '^5.13.0',
      '@fortawesome/free-regular-svg-icons': '^5.13.0',
      '@fortawesome/free-solid-svg-icons': '^5.13.0',
      'aurelia-animator-css': '1.0.4',
      'aurelia-binding': '2.5.4',
      'aurelia-bootstrapper': '2.3.3',
      'aurelia-event-aggregator': '1.0.3',
      'aurelia-fetch-client': '1.8.2',
      'aurelia-framework': '1.3.1',
      'aurelia-history': '1.2.1',
      'aurelia-history-browser': '1.4.0',
      'aurelia-loader-nodejs': '1.1.0',
      'aurelia-loader-webpack': '2.2.1',
      'aurelia-logging-console': '1.1.1',
      'aurelia-pal': '1.8.2',
      'aurelia-pal-browser': '1.8.1',
      'aurelia-pal-nodejs': '2.0.0',
      'aurelia-polyfills': '1.3.4',
      'aurelia-router': '1.7.1',
      'aurelia-templating': '1.10.4',
      'aurelia-templating-resources': '1.13.1',
      'aurelia-templating-router': '1.4.0',
      autotrack: '^2.4.1',
      'fuse.js': '^5.1.0',
      koa: '2.13.0',
      'koa-cache-control': '^2.0.0',
      'koa-static': '5.0.0',
      mysql2: '^2.1.0',
      'node-fetch': '^2.6.1',
      'normalize.css': '^8.0.1',
      preboot: '^4.5.2',
      'serverless-http': '^2.6.0',
      showdown: '^1.9.1',
      'source-map-support': '^0.5.16',
      tslib: '^1.10.0'
    },
    devDependencies: {
      '@types/aws-lambda': '^8.10.34',
      '@types/fancybox': '^3.5.2',
      '@types/fetch-mock': '^7.3.1',
      '@types/google.analytics': '0.0.40',
      '@types/jasmine': '^3.4.4',
      '@types/koa': '^2.0.50',
      '@types/koa-cache-control': '^2.0.1',
      '@types/koa-static': '^4.0.1',
      '@types/leaflet': '^1.5.12',
      '@types/lodash': '^4.14.117',
      '@types/node': '^10.11.6',
      '@types/node-fetch': '^2.5.3',
      '@types/showdown': '^1.9.3',
      '@types/swiper': '^5.3.0',
      '@types/webpack': '^4.4.15',
      'app-settings-loader': '^1.0.2',
      'aurelia-cli': '^1.0.2',
      'aurelia-tools': '^2.0.0',
      'aurelia-webpack-plugin': '^3.0.0',
      autoprefixer: '^9.4.8',
      'aws-sdk': '^2.683.0',
      'clean-webpack-plugin': '^1.0.1',
      'copy-webpack-plugin': '^5.0.4',
      'css-loader': '^1.0.0',
      cssnano: '^4.1.10',
      'duplicate-package-checker-webpack-plugin': '^3.0.0',
      ejs: '2.7.1',
      'expose-loader': '^0.7.5',
      'fetch-mock': '^7.7.3',
      'file-loader': '^2.0.0',
      gulp: '^4.0.0',
      'html-loader': '^0.5.5',
      'html-webpack-plugin': '^4.0.4',
      jasmine: '^3.5.0',
      'jasmine-core': '^3.2.1',
      'json-loader': '^0.5.7',
      karma: '^4.1.0',
      'karma-chrome-launcher': '^2.2.0',
      'karma-jasmine': '^2.0.1',
      'karma-mocha-reporter': 'latest',
      'karma-sourcemap-loader': '^0.3.7',
      'karma-webpack': '^4.0.0-rc.3',
      'mini-css-extract-plugin': '^0.9.0',
      minimatch: '^3.0.4',
      'node-noop': '^1.0.0',
      'node-sass': '^4.11.0',
      nodemon: '1.19.3',
      nps: '5.9.8',
      'nps-utils': '1.7.0',
      'postcss-loader': '^3.0.0',
      prettier: '2.0.5',
      'sass-loader': '^7.1.0',
      serverless: '^2.4.0',
      'serverless-apigw-binary': '^0.4.4',
      'serverless-webpack': '^5.3.5',
      'style-loader': '^0.23.1',
      through2: '^3.0.0',
      'tree-kill': '^1.2.1',
      'ts-loader': '^5.2.1',
      'ts-node': '^7.0.1',
      typescript: '^3.6.4',
      'url-loader': '^1.1.2',
      'vinyl-fs': '^3.0.3',
      webpack: '^4.27.0',
      'webpack-bundle-analyzer': '^3.0.4',
      'webpack-cli': '^3.1.2',
      'webpack-dev-server': '^3.1.9',
      'webpack-node-externals': '1.7.2'
    }
  },
  fs: { numberOfFiles: 189 },
  debug: [
    '2020-12-24T06:53:29.594Z project Wallaby Node version: v12.7.0\n',
    '2020-12-24T06:53:29.594Z project Wallaby config: REDACTED\\wallaby.conf.js\n',
    '2020-12-24T06:53:30.476Z project File cache: REDACTED\\.vscode\\extensions\\wallabyjs.wallaby-vscode-1.0.254\\projects\\7d83e03c96a787ce\n',
    '2020-12-24T06:53:30.558Z uiService Listening port 51235\n',
    '2020-12-24T06:53:30.589Z project Config file change detected, invalidating local cache\n',
    '2020-12-24T06:53:30.671Z workers Parallelism for initial run: 6, for regular run: 3\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #0\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #1\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #2\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #3\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #4\n',
    '2020-12-24T06:53:30.671Z workers Starting run worker instance #5\n',
    '2020-12-24T06:53:30.673Z workers Web server is listening at 58422\n',
    '2020-12-24T06:53:30.683Z project Stopping process pool\n',
    '2020-12-24T06:53:30.683Z project File cache is up-to-date, starting full test run\n',
    '2020-12-24T06:53:30.686Z project Running postprocessor\n',
    '2020-12-24T06:53:30.691Z postprocessor Processing started.\n',
    '2020-12-24T06:53:30.691Z postprocessor Initializing.\n',
    '2020-12-24T06:53:30.692Z postprocessor Initializing entry.\n',
    '2020-12-24T06:53:30.692Z postprocessor Sanitizing configuration.\n',
    '2020-12-24T06:53:30.692Z postprocessor Adjusting configuration.\n',
    '2020-12-24T06:53:30.692Z postprocessor Creating compiler.\n',
    '2020-12-24T06:53:30.887Z postprocessor Customizing compiler.\n',
    '2020-12-24T06:53:30.887Z postprocessor Compilation started.\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #0\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #1\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #2\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #3\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #4\n',
    '2020-12-24T06:53:31.349Z workers Started run worker instance (immediate) #5\n',
    '2020-12-24T06:53:35.639Z postprocessor Compilation finished.\n',
    '2020-12-24T06:53:36.261Z postprocessor Emitting 379 files.\n',
    '2020-12-24T06:53:36.264Z postprocessor Processing finished.\n',
    '2020-12-24T06:53:36.295Z project Postprocessor execution finished\n',
    '2020-12-24T06:53:36.295Z project Test run started; run priority: 3\n',
    '2020-12-24T06:53:36.295Z project Running all tests\n',
    '2020-12-24T06:53:36.303Z workers Starting test run, priority: 3\n',
    '2020-12-24T06:53:36.303Z chromeRunner Starting sandbox [worker #0, session #rgld3]\n',
    '2020-12-24T06:53:36.303Z chromeRunner Preparing sandbox [worker #0, session #rgld3]\n',
    '2020-12-24T06:53:36.304Z browserRunner Total files to load in sandbox: 5\n',
    '2020-12-24T06:53:36.305Z browserRunner Sandbox is generated [worker #0, session #rgld3]: http://localhost:58422/wallaby_sandbox0.html\n',
    '2020-12-24T06:53:36.305Z chromeRunner Prepared sandbox [worker #0, session #rgld3]\n',
    '2020-12-24T06:53:36.305Z workers [worker #0, session #rgld3] Running tests in sandbox\n',
    '2020-12-24T06:53:36.664Z workers [rgld3] Loaded 1 test(s)\n',
    '2020-12-24T06:53:37.074Z workers [rgld3] Test executed: Clone\n',
    '2020-12-24T06:53:37.931Z workers [rgld3] Run 1 test(s), skipped 0 test(s)\n',
    '2020-12-24T06:53:37.933Z workers [rgld3] Sandbox is responsive, closing it\n',
    '2020-12-24T06:53:37.934Z project Test run finished\n',
    '2020-12-24T06:53:37.935Z project Processed console.log entries\n',
    '2020-12-24T06:53:37.935Z project Processed loading sequences\n',
    '2020-12-24T06:53:37.935Z project Processed executed tests\n',
    '2020-12-24T06:53:37.942Z project Processed code coverage\n',
    '2020-12-24T06:53:37.982Z project Test run result processed and sent to IDE\n'
  ]
}

Test File

import { deepCloneJSON, deepClone } from "./utilities";

describe("Clone", () => {
  it("Clone", async () => {
    let times = 10000;
    const object = SOME_OBJECT;
    while (times--) {
      deepClone(object); /*?.*/
    }
    times = 10000;
    while (times--) {
      deepCloneJSON(object); /*?.*/
    }
  });
});

App Code File

export function deepClone<T>(value: T): T {
  // This is about half the speed of the other option below
  const n = new Notification("", { data: value, silent: true });
  n.onshow = n.close.bind(n);
  return n.data;
}
export function deepCloneJSON<T>(value: T): T {
  return JSON.parse(JSON.stringify(value));
}

Screenshot

image

ArtemGovorov commented 3 years ago

We have set up a sample repo with your dependencies, but everything is working for us:

Screen Shot 2020-12-24 at 5 53 28 pm

Can you please:

googleoryx commented 3 years ago

1) The other live comments aren't working in the test file 2) Your sample repo works fine 3) I'll post more info soon hopefully

smcenlly commented 3 years ago

@googleoryx - is it possible that your project is configured to remove comments from your code when running tests? In this case, the behavior would be expected because Wallaby would never receive the performance comment hints. You should be able to replicate the problem with /*?*/ as well as with /*?.*/.

If you are using TypeScript, comments are removed if the removeComments property is set to false.

If you are using Babel, comments are removed if the comments setting is false.

You may have some other plugin/transform that is stripping comments from the code that your project provides to Wallaby.


Since we have not had any further correspondence on this issue, I am closing for now. If you reply with more details on your problem, we will re-open.