Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support needed to configure extension #7

Closed
zerowww opened this issue Oct 28, 2021 · 8 comments
Closed

Support needed to configure extension #7

zerowww opened this issue Oct 28, 2021 · 8 comments

Comments

@zerowww
Copy link

zerowww commented Oct 28, 2021

Describe the Bug

  • Could not listen for Karma events - Test execution failed: Test run encountered an error

Steps to Reproduce the Behavior

  1. Start extension with default parameters

Describe the Expected Behavior

  • Extension working

Debug Logs

  • With the karmaTestExplorer.logLevel set to debug, please capture and attach the logs from the Karma Test Explorer Output panel.

Please Provide the Following Information

  • OS: Windows
  • Environment (e.g. DevContainer Guest OS and version)
  • Version (e.g. 22)

Additional Context

  • Important part of logs :
[2021-10-28 09:38:50.715] [DEBUG] [KarmaAutoWatchTestEventProcessor]: Done concluding ambient test event processing
[2021-10-28 09:38:50.730] [DEBUG] [KarmaTestEventListener]: Received Karma event: run_start
[2021-10-28 09:38:50.730] [DEBUG] [KarmaTestEventListener]: Test run started for browsers: 
[2021-10-28 09:38:50.730] [DEBUG] [KarmaTestEventListener]: New test run starting with id 'undefined' is not for the current requested test run Id: f7mdkaiz
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventListener]: Received Karma event: run_complete
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventListener]: Test run completed with status 'Error' for browsers: 
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventListener]: Test error processing requested with message: Test run encountered an error
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventListener]: Sending test error event to test event processor with message: Test run encountered an error
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventProcessor]: Request to process test error event with message: Test run encountered an error
[2021-10-28 09:38:50.731] [DEBUG] [KarmaTestEventProcessor]: Request to conclude test event processing
[2021-10-28 09:38:50.732] [ERROR] [KarmaTestEventListener]: Could not listen for Karma events - Test execution failed: Test run encountered an error
@lucono
Copy link
Owner

lucono commented Oct 29, 2021

Thanks for raising the issue, @zerowww. Could you also attach the logs from the Karma Server output channel when this issue occurs? That will help understand what issue Karma is running into. Thanks.

@zerowww
Copy link
Author

zerowww commented Oct 29, 2021

29 10 2021 11:32:25.554:WARN [karma]: No captured browser, open http://localhost:9976/


29 10 2021 11:32:25.562:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9976/


29 10 2021 11:32:25.562:INFO [launcher]: Launching browsers KarmaTestExplorer_CustomLauncher with concurrency unlimited


29 10 2021 11:32:25.566:INFO [launcher]: Starting browser ChromeHeadless


29 10 2021 11:32:34.132:WARN [karma]: No captured browser, open http://localhost:9976/

29 10 2021 11:32:34.194:INFO [Chrome Headless 95.0.4638.54 (Windows 10)]: Connected on socket PKKaShZlzw9kKS0TAAAA with id 23457334

29 10 2021 11:32:34.775:WARN [karma]: Error during refresh file list. TypeError: Cannot read property 'push' of undefined
    at C:\Users\zeroww\work\allint\node_modules\karma\lib\reporters\multi.js:11:61
    at Array.forEach (<anonymous>)
    at MultiReporter.addAdapter (C:\Users\zeroww\work\allint\node_modules\karma\lib\reporters\multi.js:11:21)
    at Server.<anonymous> (C:\Users\zeroww\work\allint\node_modules\karma\lib\middleware\runner.js:97:18)
    at Object.onceWrapper (events.js:421:26)
    at Server.emit (events.js:326:22)
    at Server.e.emit (C:\Users\zeroww\.vscode\extensions\lucono.karma-test-explorer-0.2.1\dist\karma.conf.js:179:18545)
    at Executor.schedule (C:\Users\zeroww\work\allint\node_modules\karma\lib\executor.js:31:20)
    at Server.<anonymous> (C:\Users\zeroww\work\allint\node_modules\karma\lib\server.js:371:18)
    at Server.emit (events.js:326:22)
    at Server.e.emit (C:\Users\zeroww\.vscode\extensions\lucono.karma-test-explorer-0.2.1\dist\karma.conf.js:179:18545)
    at emit (C:\Users\zeroww\work\allint\node_modules\karma\lib\file-list.js:30:21)
    at FileList._emitModified (C:\Users\zeroww\work\allint\node_modules\karma\lib\file-list.js:35:19)
    at C:\Users\zeroww\work\allint\node_modules\karma\lib\file-list.js:110:14
    at refreshFileList (C:\Users\zeroww\work\allint\node_modules\karma\lib\middleware\runner.js:89:9)





Chrome Headless 95.0.4638.54 (Windows 10) JASMINE ORDER REPORTER LOG: Started with seed 64997
Chrome Headless 95.0.4638.54 (Windows 10) JASMINE ORDER REPORTER: Started with seed 64997

JASMINE ORDER REPORTER LOG: Done with seed 64997

JASMINE ORDER REPORTER: Done with seed 64997


Chrome Headless 95.0.4638.54 (Windows 10): Executed 0 of 1007 (skipped 1007) SUCCESS (0.968 secs / 0 secs)

TOTAL: 0 SUCCESS


TOTAL: 0 SUCCESS

Thanks @lucono for the support !

@lucono
Copy link
Owner

lucono commented Oct 30, 2021

@zerowww Thanks for the additional logs. I've seen this issue in the past when certain karma plugins are also present, such as the browserstack launcher. Could you share what plugins you're running with?

@zerowww
Copy link
Author

zerowww commented Oct 30, 2021

[
  {
    "name": "angular-component-extension",
    "publisher": "onixie",
    "version": "0.0.14"
  },
  {
    "name": "code-settings-sync",
    "publisher": "Shan",
    "version": "3.4.3"
  },
  {
    "name": "gitlens",
    "publisher": "eamodio",
    "version": "11.6.1"
  },
  {
    "name": "indent-rainbow",
    "publisher": "oderwat",
    "version": "8.2.2"
  },
  {
    "name": "markdown-all-in-one",
    "publisher": "yzhang",
    "version": "3.4.0"
  },
  {
    "name": "material-icon-theme",
    "publisher": "PKief",
    "version": "4.10.0"
  },
  {
    "name": "ng-template",
    "publisher": "Angular",
    "version": "12.2.2"
  },
  {
    "name": "night-owl",
    "publisher": "sdras",
    "version": "2.0.1"
  },
  {
    "name": "prettier-vscode",
    "publisher": "esbenp",
    "version": "9.0.0"
  },
  {
    "name": "sonarlint-vscode",
    "publisher": "SonarSource",
    "version": "3.1.0"
  },
  {
    "name": "template-string-converter",
    "publisher": "meganrogge",
    "version": "0.5.3"
  },
  {
    "name": "vs-ng-quick-switch",
    "publisher": "erhise",
    "version": "1.0.7"
  },
  {
    "name": "vscode-angular-html",
    "publisher": "ghaschel",
    "version": "1.7.0"
  },
  {
    "name": "vscode-html-css",
    "publisher": "ecmel",
    "version": "1.10.2"
  },
  {
    "name": "vscode-typescript-tslint-plugin",
    "publisher": "ms-vscode",
    "version": "1.3.3"
  },
  {
    "name": "vscode-versionlens",
    "publisher": "pflannery",
    "version": "1.0.9"
  },
  {
    "name": "vscode-wrap-console-log",
    "publisher": "midnightsyntax",
    "version": "1.7.2"
  },
    "name": "vscodeintellicode",
    "publisher": "VisualStudioExptTeam",
    "version": "1.2.14"
  },
  {
    "name": "vsliveshare",
    "publisher": "ms-vsliveshare",
    "version": "1.0.5043"
  }
]

And here is my karma conf:

module.exports = function (config) {
  config.reportsFolder = require('path').join(__dirname, '..', '..', 'reports', 'tests', 'spec');

  config.coverageReporterFolder = process.env.KARMA_COVERAGE_REPORTER_RELATIVE_FOLDER
    ? require('path').join(__dirname, '..', '..', process.env.KARMA_COVERAGE_REPORTER_RELATIVE_FOLDER)
    : require('path').join(config.reportsFolder, 'coverage');

  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-firefox-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('karma-spec-reporter'),
      require('@angular-devkit/build-angular/plugins/karma'),
      require('karma-sabarivka-reporter'),
      require('karma-jasmine-order-reporter'),
    ],
    customLaunchers: {
      ChromeHeadless: {
        base: 'Chrome',
        flags: [
          '--headless',
          '--disable-gpu',
          // Without a remote debugging port, Google Chrome exits immediately.
          '--remote-debugging-port=9222',
          '--no-sandbox',
        ],
      },
      FirefoxHeadless: {
        base: 'Firefox',
        flags: ['-headless'],
      },
    },
    client: {
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      jasmine: {
        random: true,
        seed: process.env['JASMINE_SEED'],
      },
    },
    coverageReporter: {
      include: [
        'projects/allint/**/src/**/!(*.spec|*.module|public-api).(ts|js)',
        '!projects/allint/**/src/**/models/*.ts',
      ],
    },
    coverageIstanbulReporter: {
      dir: config.coverageReporterFolder,
      combineBrowserReports: true,
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true,
      thresholds: {
        emitWarning: false,
        global: {
          statements: 100,
          lines: 100,
          branches: 100,
          functions: 100,
        },
      },
    },
    reporters: ['spec', 'sabarivka', 'jasmine-order'],
    specReporter: {
      showSpecTiming: true,
      suppressSkipped: true,
    },
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeHeadless', 'FirefoxHeadless'],
    singleRun: false,
    restartOnFileChange: true,
  });
};

Thanks @lucono !

@zerowww
Copy link
Author

zerowww commented Oct 30, 2021

I have tried to use the extension without any extension enabled, it doesn't work, same error happening, I have also tried with lastest node version (v16.12.0) instead of the node version I usually use (v12.xx.x) and it doesn't work neither ...

Maybe my karma version is too old ?

   "jasmine-core": "~3.6.0",
    "jasmine-marbles": "^0.6.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~5.2.3",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.3",
    "karma-fail-fast-reporter": "^1.0.5",
    "karma-firefox-launcher": "^2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.4.2",
    "karma-jasmine-order-reporter": "^1.0.0",
    "karma-junit-reporter": "^2.0.1",
    "karma-sabarivka-reporter": "^3.2.5",
    "karma-spec-reporter": "^0.0.32",

@lucono
Copy link
Owner

lucono commented Nov 4, 2021

@zerowww, I've included a fix for this in PR #11. Could you test with the beta branch to verify if it resolves the issue for you before I publish to the marketplace. You can build it locally with npm run validate, and install the .vsix file that's generated in the project root, which should show up as version 0.3.0. Thanks.

@zerowww
Copy link
Author

zerowww commented Nov 4, 2021

@lucono Yep, it's working with the beta version, thanks a lot !

@zerowww zerowww closed this as completed Nov 4, 2021
lucono added a commit that referenced this issue Nov 7, 2021
Bugfixes for #7 #9 #10, and a couple of other small fixes and enhancements
@lucono
Copy link
Owner

lucono commented Nov 7, 2021

@zerowww That's great. I've published it to the marketplace. Feel free report any future issues you run into. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants