-
-
Notifications
You must be signed in to change notification settings - Fork 364
Open
Labels
Description
Considering a simple TS file like src/main.ts
function Foo(constructorFunction: Function) {
console.log('Foo decorator')
}
@Foo
class Main {
constructor() {
console.log('Running')
}
}
new Main();
then trying to instrument it by running:
yarn nyc instrument --compact=false src instrumented
with the following configuration:
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"all": true
}
then the result file instrumented/main.ts
is not instrumented.
If we comment the @Foo
decorator, then the file is instrumented again.
function Foo(constructorFunction: Function) {
console.log('Foo decorator')
}
// @Foo
class Main {
constructor() {
console.log('Running')
}
}
new Main();
result instrumented/main.ts
:
// ...
function Foo(constructorFunction: Function) {
cov_1eomntdplb.f[0]++;
cov_1eomntdplb.s[0]++;
console.log('Foo decorator');
} // @Foo
class Main {
constructor() {
cov_1eomntdplb.f[1]++;
cov_1eomntdplb.s[1]++;
console.log('Running');
}
}
cov_1eomntdplb.s[2]++;
new Main();
Am I missing something or is there an issue with decorators?
gaollard