Я хочу запустить angular жасминовые тесты на машине linux.
Я получаю сообщение об ошибке:
> ng test --watch=false --code-coverage
[32m26 02 2020 02:44:05.933:INFO [karma-server]: [39mKarma v4.1.0 server started at http://0.0.0.0:9876/
[32m26 02 2020 02:44:05.938:INFO [launcher]: [39mLaunching browsers PhantomJS with concurrency unlimited
[32m26 02 2020 02:44:05.970:INFO [launcher]: [39mStarting browser PhantomJS
[32m26 02 2020 02:44:29.272:INFO [PhantomJS 2.1.1 (Linux 0.0.0)]: [39mConnected on socket Ew46sEHwaLSfgmQWAAAA with id 52382003
PhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 0 SUCCESS (0 secs / 0 secs)
[1A[2KPhantomJS 2.1.1 (Linux 0.0.0): Executed 0 of 0 ERROR (0.04 secs / 0 secs)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-app@0.0.0 code-coverage: `ng test --watch=false --code-coverage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-app@0.0.0 code-coverage script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Файл журнала npm:
info it worked if it ends with ok
verbose cli [ '/localdisk/opt/nodejs/node-v10.16.0-linux-x64/bin/node',
verbose cli '/localdisk/opt/nodejs/current/bin/npm',
verbose cli 'run',
verbose cli 'code-coverage' ]
info using npm@6.9.0
info using node@v10.16.0
verbose run-script [ 'precode-coverage', 'code-coverage', 'postcode-coverage' ]
info lifecycle my-app@0.0.0~precode-coverage: my-app@0.0.0
info lifecycle my-app@0.0.0~code-coverage: my-app@0.0.0
verbose lifecycle my-app@0.0.0~code-coverage: unsafe-perm in lifecycle true
verbose lifecycle my-app@0.0.0~code-coverage: PATH: /localdisk/opt/nodejs/node-v10.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/localdisk/home/bambooagent/agent1/xml-data/build-dir/my-project/selfportal-ui/node_modules/.bin:/usr/java/jdk1.7/bin:/localdisk/opt/nodejs/current/bin:/usr/lib64/qt-3.3/bin:/usr/local/bin:/usr/bin
verbose lifecycle my-app@0.0.0~code-coverage: CWD: /localdisk/home/bambooagent/agent1/xml-data/build-dir/my-project/selfportal-ui
silly lifecycle my-app@0.0.0~code-coverage: Args: [ '-c', 'ng test --watch=false --code-coverage' ]
silly lifecycle my-app@0.0.0~code-coverage: Returned: code: 1 signal: null
info lifecycle my-app@0.0.0~code-coverage: Failed to exec code-coverage script
verbose stack Error: my-app@0.0.0 code-coverage: `ng test --watch=false --code-coverage`
verbose stack Exit status 1
verbose stack at EventEmitter.<anonymous> (/localdisk/opt/nodejs/node-v10.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
verbose stack at EventEmitter.emit (events.js:198:13)
verbose stack at ChildProcess.<anonymous> (/localdisk/opt/nodejs/node-v10.16.0-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
verbose stack at ChildProcess.emit (events.js:198:13)
verbose stack at maybeClose (internal/child_process.js:982:16)
verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
verbose pkgid my-app@0.0.0
verbose cwd /localdisk/home/bambooagent/agent1/xml-data/build-dir/my-project/selfportal-ui
verbose Linux 3.10.0-1062.1.1.el7.x86_64
verbose argv "/localdisk/opt/nodejs/node-v10.16.0-linux-x64/bin/node" "/localdisk/opt/nodejs/current/bin/npm" "run" "code-coverage"
verbose node v10.16.0
verbose npm v6.9.0
error code ELIFECYCLE
error errno 1
error my-app@0.0.0 code-coverage: `ng test --watch=false --code-coverage`
error Exit status 1
error Failed at the my-app@0.0.0 code-coverage script.
error This is probably not a problem with npm. There is likely additional logging output above.
verbose exit [ 1, true ]
Мой karma.conf. js:
process.env.CHROME_BIN = require('puppeteer').executablePath();
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-phantomjs-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma'),
],
client: {
jasmine: {
random: true,
},
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'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
customLaunchers: {
ChromeHeadless: {
base: 'chrome',
flags: ['--headless', '--disable-gpu', '--no-sandbox'],
},
},
browsers: ['PhantomJS'],
singleRun: true,
});
};
tsconfig.spe c. json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/spec",
"baseUrl": "./",
"module": "commonjs",
"types": [
"jasmine",
"node"
],
"target": "ES5"
},
"files": [
"test.ts",
"polyfills.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
tsconfig.app. json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"baseUrl": "./",
"module": "es2015",
"types": ["node"]
},
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
tsconfig. json:
{
"compileOnSave": false,
"preserveWhitespaces": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"downlevelIteration": true,
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
}
Что может быть не так?