Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    baumfrosch2000
    @baumfrosch2000
    Good morning Waza. Of course I can. Wait a minute ...
    launch.json:

    {
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
    {
    "type": "chrome",
    "request": "launch",
    "name": "Launch Chrome against localhost",
    "url": "http://localhost:4200",
    "webRoot": "${workspaceFolder}"
    },
    {
    "type": "chrome",
    "request": "attach",
    "name": "Attach Karma Chrome",
    "address": "127.0.0.1",
    "port": 9333,
    "pathMapping": {
    "/": "${workspaceRoot}",
    "base/": "${workspaceRoot}",
    "_karmawebpack": "${workspaceFolder}"
    },
    "sourceMaps": true
    },

    ]

    }

    karma.conf.js:
    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/blackbox'),
    reports: ['html', 'lcovonly', 'text-summary'],
    fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml'],
    // old port: 9333
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    // old browsers: ['Chrome'],
    browsers: [
    'ChromeDebugging'
    ],
    customLaunchers: {
    ChromeDebugging: {
    base: 'Chrome',
    flags: [ '--remote-debugging-port=9333' ]
    }
    },
    singleRun: false,
    restartOnFileChange: true,
    });
    };
    These are the two files I configured.
    Waza
    @waza-kaunda
    Try explicitly set the port to your launch configuration to port: 9876 for your launch
    baumfrosch2000
    @baumfrosch2000
    You mean I shall replace port 9333 in the launch.json with 8976?
    Waza
    @waza-kaunda
    for the tests I set the port to 9877
    baumfrosch2000
    @baumfrosch2000
    If I change to 9876 I get the following error:
    Connection to runtime-process not possible. Timeout after 10000 ms (reason: Connection with target not found)
    Waza
    @waza-kaunda
    first thing I think you should make sure of is all the launch configs have the port numbers explicitly set
    then insure that the port on your unit test config is different from your launch
    code
    {
    "type": "chrome",
    "request": "attach",
    "name": "Unit tests",
    "address": "localhost",
    "port": 9877,
    "sourceMaps": true,
    "webRoot": "${workspaceFolder}/....",
    "pathMapping": {
    "/_karmawebpack": "${workspaceFolder}/..."
    }
    },
    {
    "type": "chrome",
    "request": "launch",
    "name": "...",
    "url": "http://localhost:4200",
    "preLaunchTask": "mock:start",
    "postDebugTask": "debug:stop",
    "webRoot": "...",
    "port": 9876
    },
    baumfrosch2000
    @baumfrosch2000
    Unfortunatelly I get the same error message as before when I start the tests :-(
    Waza
    @waza-kaunda
    okay have a look at my karma.conf.js see if anything jumps out.
    code
    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'), require('karma-spec-reporter') ], client: { clearContext: false // leave Jasmine Spec Runner output visible in browser }, coverageIstanbulReporter: { dir: require('path').join(__dirname, '../coverage'), reports: ['html', 'lcovonly'], fixWebpackSourcePaths: true }, reporters: ['progress', 'kjhtml', 'spec'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false }); };
    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'),
          require('karma-spec-reporter')
        ],
        client: {
          clearContext: false // leave Jasmine Spec Runner output visible in browser
        },
        coverageIstanbulReporter: {
          dir: require('path').join(__dirname, '../coverage'),
          reports: ['html', 'lcovonly'],
          fixWebpackSourcePaths: true
        },
        reporters: ['progress', 'kjhtml', 'spec'],
        port: 9876,
        colors: true,
        logLevel: config.LOG_INFO,
        autoWatch: true,
        browsers: ['Chrome'],
        singleRun: false
      });
    };
    baumfrosch2000
    @baumfrosch2000
    Thank you!
    Waza
    @waza-kaunda
    No problem hope you come good
    baumfrosch2000
    @baumfrosch2000
    I meant thank you for your code :-)
    Still same error message. My karma.conf.js is similar to yours.
    ... connect: ECONNREFUSED 127.0.0.1:9877
    Waza
    @waza-kaunda
    did you remove this flag flags: [ '--remote-debugging-port=9333' ]
    baumfrosch2000
    @baumfrosch2000
    Yes, I removed the complete customLaunchers-attribute
    Here is my karma.conf.js
    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/blackbox'),
    reports: ['html', 'lcovonly', 'text-summary'],
    fixWebpackSourcePaths: true
    },
    reporters: ['progress', 'kjhtml', 'spec'],
    // old port: 9333
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    // browsers: [
    // 'ChromeDebugging'
    // ],
    // customLaunchers: {
    // ChromeDebugging: {
    // base: 'Chrome',
    // flags: [ '--remote-debugging-port=9333' ]
    // }
    // },
    singleRun: false
    // restartOnFileChange: true,
    });
    };
    Waza
    @waza-kaunda
    other than that I'm pretty stumped I don't see what could be preventing you from connecting.
    baumfrosch2000
    @baumfrosch2000
    Yes, I am also pretty frustrated
    baumfrosch2000
    @baumfrosch2000
    Waza, we have not talked about my yesterday's question:
    An error message pops up, saying something like "Connection with runtime process not possible, timeout after 10000 ms (reason: no valid target found, which corresponds to "about: blank". Availabe pages: "http://localhost:9876/id=...". Before I start Visual Studio Code the port 9876 is empty, after starting Visual Studio Code, this port is occupied and it prevents the normal debugging
    As soon as the Angular/Karma test Explorer is loaded, node.js is loaded on port 9876 and blocks all attempts, to test the applicatation. I think this loading is the reason for the failure ... But how can I prevent it?
    Waza
    @waza-kaunda
    Yes that's because the karma test explorer needs to run the node server in the background to run the tests from the vscode I think
    Alberto Bonfiglio
    @DarthBert
    HI, i may be dumb but can't figureout why the explorer is stuck at loading (spinning icon) with no output in the console (test explorer log). It works fine if i create a new angular app (ang 9.0.7, nodejs 13.8.0 win10) bit not if it's inside a dotnet app (dotnet 3.1 ang 9.0.7, nodejs 13.8.0 win10). Any chance it's the path? The app in dotnet is in c:\repos\project\ClientApp
    Alberto Bonfiglio
    @DarthBert
    Actually to be correct project is in C:\Repo\project\application1\ClientApp, and vscode (insiders) is open at C:\Repo\project
    Alberto Bonfiglio
    @DarthBert
    If I open the project with vscode directly in clientapp it works.... Must be the path...
    Alberto Bonfiglio
    @DarthBert
    So if I open vscode at the project folder should I set the project root path as ./application1/Clientapp?
    Waza
    @waza-kaunda
    Take a look at the vs code path variables which will help you figure out your path mine generally start with {workspaceFolder}/...
    benoni marinho silva
    @benonisilva_twitter
    cant set userKarmaConfFilePath - my settings "angularKarmaTestExplorer.debugMode": true,
    "angularKarmaTestExplorer.karmaConfFilePath": "src/karma.conf.dev.js",
    Gareth
    @garethallenstringer

    Hi there, I'm trying to get started with Angular/Karma Test Explorer, and Test Explorer in general but haven't got beyond the Test tab just 'Reloading Tests'. I've tried multiple different combinations within the AKTE settings but to no avail.

    When I've tried to use the 'AKTE: Select Project' command from the Command Palette the response is 'Cannot read property 'test' of undefined.

    I am using the Remote -WSLextension, with Debugger for Chrome, Test Explorer UI and the AKTE extensions installed on WSL: Ubuntu. The Debugger for Chrome extension is enabled on WSL: Ubuntu and is disabled locally. This is a requirement for Test Explorer UI to work.

    The project I am trying to use this on has a slightly unique structure that I'll explain if relevant. The folder I have open in VS Code is the root of the angular project, where angular.json exists. This directory contains the src directory which has karma.conf.js inside.

    Does anybody have any ideas? I've read through the documentation and tried to determine what should be in the settings but haven't been able to. Many thanks

    Navneet Kumar Sharma
    @navneetsharma1988
    Hi, I could not debug the unit test...
    debug point says no source map is available for typescript..
    Please share the steps needed to run the test... and how can I load the unit test faster in Test Explorer UI?
    BePo65
    @BePo65

    I'm desperate as I cannot debug the tests in my angular project with vscode testexplorer - the test all run fine, but the debugger doesn't hit the breakpoints. No new topic, but although I tried all the 'tricks' mentioned here and in the issues of the repository, no breakpoint was hit.

    So I generated the simplest possible project with angular-cli (V9 - see BePo65/test-testexplorer-debug), but even here no breakpoint was hit.

    The problem can be seen here screenshot debugger.
    The result of the 'run test with debug' is here testexplorer log,
    the configuration of the testexplorer is as follows testexplorer config
    and the configuration of the karma adapter is here testadapter karma.

    As the problem occurs also on the minimal project, I suppose that it a consequence of missing / wrong configurations in my vscode. <but I am running out of ideas, so any help appreciated.

    BePo65
    @BePo65
    Seems that I messed up the screenshots - the images can be found in the repository in the folder 'documentation'.
    Dominic Seitz
    @dome4
    image.png
    Hey guys, im experiencing the previous announced issue with test explorer. Can somebody help please? I'm on ubuntu
    Adrian Brunton
    @ajbrun
    Hi - I'm currently having an issue with the refresh icon always being active (reloading tests). I've seen on the github issues, people have been finding errors via the test explorer logs. Could someone point me to where they're located please?