Я пытаюсь подключить отладчик vscode к моим угловым 4-х модульным тестам, которые используют карму в качестве бегуна.
Я использую камру 1.7.1 и угловой 4.
Мой launch.json выглядит так:
{
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "attach",
"name": "Attach Karma Chrome",
"address": "localhost",
"port": 9333,
"pathMapping": {
"/": "${workspaceRoot}",
"/base/": "${workspaceRoot}/"
}
}
]
}
Мой karma.conf.js выглядит так:
// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
const join = require('path').join;
module.exports = function ( config )
{
config.set( {
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('karma-verbose-reporter'),
require('@angular/cli/plugins/karma')
],
files: [
{ pattern: 'src/test.ts' }
],
coverageIstanbulReporter: {
reports: [ 'html', 'lcovonly' ],
fixWebpackSourcePaths: true,
dir: join(__dirname, 'metrics', 'coverage')
},
angularCli: {
environment: 'dev'
},
reporters: ['progress', 'verbose'],
port: 9876,
logLevel: config.LOG_DEBUG,
autoWatch: true,
customLaunchers: {
ChromeCI: {
base: 'ChromeHeadless',
flags: ['--no-sandbox', '--headless']
}
},
browsers: ['ChromeCI'],
singleRun: false
} );
};