Karma run with ng test does not find any tests to run

Discussão em 'Angular' iniciado por Munchkin, Agosto 6, 2025.

  1. Munchkin

    Munchkin Guest

    So I have the default and one custom spec.ts file laying around in my Angular 10 project and none of them get detected by Karma to run. Any clue why this could be happening?

    My Karma Config file (actually unchanged):

    // Karma configuration file, see link for more information
    // https://karma-runner.github.io/1.0/config/configuration-file.html

    module.exports = function (config) {
    config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
    require('karma-jasmine'),
    require('karma-chrome-launcher'),
    require('karma-jasmine-html-reporter'),
    require('karma-coverage-istanbul-reporter'),
    require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
    clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    coverageIstanbulReporter: {
    dir: require('path').join(__dirname, './coverage/korrespo-portal'),
    reports: ['html', 'lcovonly', 'text-summary'],
    fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false,
    restartOnFileChange: true
    });
    };



    My console output:

    Chrome 88.0.4324.104 (Windows 10): Executed 0 of 0 SUCCESS (0.013 secs / 0 secs)
    TOTAL: 0 SUCCESS


    In the Karma UI this gets shown:

    Incomplete: No specs found, , randomized with seed 27463


    My ng version output:


    _ _ ____ _ ___
    / \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
    / △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
    / ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
    /_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
    |___/


    Angular CLI: 10.1.7
    Node: 12.13.1
    OS: win32 x64

    Angular: 10.2.0
    ... animations, common, compiler, compiler-cli, core, forms
    ... language-service, localize, platform-browser
    ... platform-browser-dynamic, router
    Ivy Workspace: Yes

    Package Version
    ------------------------------------------------------------
    @angular-devkit/architect 0.1002.0
    @angular-devkit/build-angular 0.1002.0
    @angular-devkit/core 10.2.0
    @angular-devkit/schematics 10.1.7
    @angular/cdk 10.2.5
    @angular/cli 10.1.7
    @angular/material 10.2.5
    @angular/material-moment-adapter 10.2.5
    @schematics/angular 10.1.7
    @schematics/update 0.1001.7
    rxjs 6.6.3
    typescript 3.9.7


    I'm running Angular 10 as you can see above and TypeScript 3.9.7 as also shown above...

    Continue reading...

Compartilhe esta Página