question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Assertion failed : (0) at the end of karma execution

See original GitHub issue

Issue

Hello, I using Karma + Webpack for running my unit tests and karma always display an error after testing and just before closing Chrome (or ChromeHeadless).

Error

The error is : Assertion failed: (0), function uv_close, file …/deps/uv/src/unix/core.c, line 187. [1] 18461 abort npm run test-debug

Below a copy of my terminal TOTAL: 87 SUCCESS 15 05 2020 15:35:04.564:DEBUG [karma-server]: Run complete, exiting. 15 05 2020 15:35:04.564:DEBUG [launcher]: Disconnecting all browsers 15 05 2020 15:35:04.564:DEBUG [launcher]: BEING_FORCE_KILLED -> BEING_FORCE_KILLED Assertion failed: (0), function uv_close, file ../deps/uv/src/unix/core.c, line 187. [1] 18552 abort npm run test-debug

Software and hardware

The issue still appear on :

  • local environment (mac os Catalina 10.15.4) running the npm script
  • local environment running the maven script (java project+react) to build the entire project. Maven will failed because of the issue
  • gitlab CI running the maven script (linux server)

Karma config

Below my karma config : `module.exports = function (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: ['requirejs', 'jasmine'],

    // list of files / patterns to load in the browser
    files: [
        //Static resources
        tests + 'test-main.js', // Will load ebxUI bundles..

        //Unit test here
        {pattern: tests + 'src/**/*.tsx', included: false},
        {pattern: tests + 'src/**/*.ts', included: false},

        //EBX lib
        {pattern: ebxUI + "js/**/*", included: false},

        {pattern: libTest + "/**/*", included: false}

    ],

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

    // // Redirect access to resources
    // proxies: {
    //   '/images/': 'http://localhost:11180/ebx-ui/images/'
    // },

    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
        //TODO coverage is not useful currently, try to do like : https://github.com/mcliment/typescript-karma-webpack-coverage-sample
        'project-folder/src/test/src/react/**/*.ts*': ['webpack'],
    },

    webpack: webpackConfig,

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

    // optionally, configure the reporter
    coverageReporter: {
        type: 'html',
        dir: tests + 'coverage/'
    },

    // 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: false,

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

    // 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",

    // Prevent karma to crash for empty
    // tests
    failOnEmptyTestSuite: false,

    // Set karma timeout
    browserNoActivityTimeout : 60000,
    processKillTimeout:30000,



    // Custom karma execution for CI
    customLaunchers: {
        ChromeCustom: {
            base: 'ChromeHeadless',
            // We must disable the Chrome sandbox when running Chrome inside Docker (Chrome's sandbox needs
            // more permissions than Docker allows by default)
            flags: isDocker ? ['--no-sandbox'] : []
        }
    }
})`

package.json file

image

More info

Sometimes (it’s rare) the script end well and I don’t have the issue.

NPM and node version

node: v12.16.3 npm:6.14.4

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8

github_iconTop GitHub Comments

1reaction
matthintoshcommented, May 15, 2020

I just test with your fix and I still have the same issue. Assertion failed: (0), function uv_close, file ../deps/uv/src/unix/core.c, line 187. Thank you for your help.

0reactions
matthintoshcommented, Sep 28, 2020

The last version of karma and karm-webpack resolve this issue ! Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Karma is running with 0 tests, and it fails the build
Yes, that's by design. Executing 0 tests is a failure. We had issues before when somebody would accidentally disable all tests and the...
Read more >
Error in Unit Testing Angular code with Karma and Jasmine
After that when I try to run karma start, I am getting the below error which says Executed 0 of 0 ERROR and...
Read more >
Front-End Unit Testing Using Karma Test Runner
This tutorial explains how to setup Karma & automate Front-End Unit Testing Using ... To fix this error, we need to install Karma...
Read more >
Troubleshooting - Karma test runner
I'm getting an error during the installation related to the ws module, ... likely Karma can't find the location of the browser binary...
Read more >
Unit testing JavaScript with Karma in 2021. Starting point
test.js". Chrome 88.0.4324.96 (Mac OS 11.1.0) My first Karma test should be true FAILED Error: Expected true to equal ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found