You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"$schema": "./node_modules/@stryker-mutator/core/schema/stryker-schema.json",
"_comment": "This config was generated using 'stryker init'. Please see the guide for more information: https://stryker-mutator.io/docs/stryker-js/guides/angular",
"mutate": [
"src/**/*.ts",
"!src/**/*.spec.ts",
"!src/test.ts",
"!src/environments/*.ts"
],
"testRunner": "karma",
"karma": {
"configFile": "karma.conf.js",
"projectType": "angular-cli",
"config": {
"browsers": [
"ChromeHeadless"
]
}
},
"reporters": [
"progress",
"clear-text",
"html"
],
"concurrency": 10,
"concurrency_comment": "Recommended to use about half of your available cores when running stryker with angular",
"coverageAnalysis": "perTest"
}
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'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with random: false
// or set a specific seed with seed: 4321
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/date-picker'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
browsers: ['Chrome'],
restartOnFileChange: true
});
};
We have reached a dilemma here. We're using Babel under the hood. Babel supports TypeScript using the @babel/preset-typescript. It enables TypeScript features like type annotations but not decorators. We enable decorators separately using the babel-plugin-proposal-decorators.
Decorators have evolved quite a lot over the years, as you can see from the "version" config option: "2023-11", "2023-05", "2023-01", "2022-03", "2021-12", "2018-09" or "legacy". TypeScript was traditionally fully compatible with the "legacy" version of Babel decorators. But since typescript 5.0, decorators are also allowed after the export keyword (as you've figured out). See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#differences-with-experimental-legacy-decorators. There is no way that I know of to get this behavior from Babel's decorator plugin. We can set the version to "2023-11" and that seems to solve it, but then constructor parameter decorators are not allowed (like constructor(@Inject(DOCUMENT) document) {}, since they are notably absent from the current decorator implementation, see the class method parameter decorators proposal
See also ts-parser.ts, where we configure the Babel plugins for TypeScript.
Summary
When i use export before any class decorator notation stryker will throw errors.
Does work
this does not work
Stryker config
Test runner config
// 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'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with
random: false
// or set a specific seed with
seed: 4321
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/date-picker'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
browsers: ['Chrome'],
restartOnFileChange: true
});
};
Stryker environment
Test runner environment
# stryker run
Your Environment
Add stryker.log
The text was updated successfully, but these errors were encountered: