lucono/karma-test-explorer

Karma server not stopped when vscode is closed

doktordirk opened this issue · 6 comments

Describe the Bug

  • Karma server not stopped when vscode is closed

Steps to Reproduce the Behavior

  1. Open vscode and wait till extensions is initialized
  2. Close vscode
  3. See orphaned node task in eg system monitor

Describe the Expected Behavior

  • Karma server stopped when vscode is closed

Provide Debug Logs

Screenshots

image

Please Provide the Following Information

  • OS: Ubuntu 20.04
  • Environment: local
  • Node Version: v16.14.0
  • VSCode Version: 1.65.0
  • Karma Version: ^6.3.14
  • Frameworks: jasmine ^2.0.1

Additional Context

  • Add any other context about the problem here.

@doktordirk if you run the command ps -fe, what's the full process command printed for the unterminated node processes?

@lucono nothing exiting i'd guess

dirk       12592    2625  9 09:25 ?        00:01:03 /usr/bin/node /home/dirk/repo/webapp/node_modules/karma/bin/karma start /home/dirk/.vscode/extensions/lucono.karma-test-explorer-0.5.0/dist/karma.conf --no-single-run
dirk       13623    2625  5 09:28 ?        00:00:25 /usr/bin/node /home/dirk/repo/webapp/node_modules/karma/bin/karma start /home/dirk/.vscode/extensions/lucono.karma-test-explorer-0.5.0/dist/karma.conf --no-single-run
dirk       14173    2625  5 09:29 ?        00:00:22 /usr/bin/node /home/dirk/repo/webapp/node_modules/karma/bin/karma start /home/dirk/.vscode/extensions/lucono.karma-test-explorer-0.5.0/dist/karma.conf --no-single-run

karma.conf.js

// Karma configuration

const path = require('path');

const buildDir = process.env.BUILD_DIR
  ? process.env.BUILD_DIR
  : '../build/tomcat/webapps/ROOT';
const srcDir = 'src/main/webapp/static-content';
const options = process.argv.filter((option) => option.startsWith('--'));

module.exports = (config) => {
  config.set({
    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',

    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['webpack', 'jasmine'],

    // list of files / patterns to load in the browser
    files: [
      {
        pattern: `${srcDir}/icon/**/*.*`,
        watched: true,
        included: false,
        served: true,
      },
      {
        pattern: `${srcDir}/img/**/*.*`,
        watched: true,
        included: false,
        served: true,
      },
      {
        pattern: `${srcDir}/font/**/*.*`,
        watched: true,
        included: false,
        served: true,
      },
      `${srcDir}/js/jquery/jquery-1.8.2.min.js`,
      {
        pattern: `${buildDir}/static-content/**/*.*`,
        watched: false,
        included: false,
        served: true,
      },
      { pattern: `${srcDir}/aurelia/aurelia-tests.js`, watched: false },
    ],

    /*
     * preprocess matching files before serving them to the browser
     * available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
     */
    preprocessors: {
      [`${srcDir}/aurelia/aurelia-tests.js`]: ['webpack'],
    },

    webpack: require('./webpack.config')({ tests: true }),

    proxies: {
      '/static/icon/': `/base/${srcDir}/icon/`,
      '/static/icon/svg/': `/base/${srcDir}/icon/svg/`,
      '/static/img/': `/base/${srcDir}/img/`,
      '/static/font/': `/base/${srcDir}/font/`,
      '/static/webpack/': `${buildDir}/static-content/`,
    },

    // list of files to exclude
    exclude: [],

    /*
     * test results reporter to use
     *
     * possible values: 'dots', 'progress'
     * available reporters: https://npmjs.org/browse/keyword/karma-reporter
     */
    reporters: ['mocha', 'coverage'],

    coverageReporter: {
      reporters: [
        { type: 'html' },
        { type: 'lcovonly' },
        { type: 'text-summary' },
      ],
      dir: `${buildDir}/karma-results`,
      subdir: '.',
    },

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    customLaunchers: {
      ChromeDebugging: {
        base: 'Chrome',
        flags: ['--remote-debugging-port=9333', '--disable-gpu', ...options],
      },
    },

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['ChromeDebugging'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity,
  });
};

no vscode settings to (karma-)test-explorer had been added

@doktordirk I'm not able to reproduce this (on ubuntu 18.04). The Karma Test Explorer and Karma Server output channel debug logs may have some information on why it might be failing to stop. If you'd like to look into it locally, the point where the server is stopped is here, which leads here further down the line, with the Karma server then killed here.

@doktordirk I was later able to reproduce this. Try out the visx from the beta branch to confirm if it resolves the issue.

tx. Issue solved!

Released in v0.6.0