Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instrumentation should honor decoratorsBeforeExport #1411

Open
1 task done
gnzzz opened this issue Jun 3, 2021 · 4 comments
Open
1 task done

Instrumentation should honor decoratorsBeforeExport #1411

gnzzz opened this issue Jun 3, 2021 · 4 comments

Comments

@gnzzz
Copy link

gnzzz commented Jun 3, 2021

Link to bug demonstration repository

https://github.com/gnzzz/nyc-bug-decorators

Expected Behavior

When decoratorsBeforeExport is set to true it will instrument typescript code with decorators. This should leave the location of the decorator and export in the same order:

@sealed
export class BugReport {

Observed Behavior

Instrumentation moves the export before the decorator:

export @sealed
class BugReport {

creating invalid typescript code:

instrumented/index.ts:86:1 - error TS1128: Declaration or statement expected.

86 export @sealed
   ~~~~~~

Troubleshooting steps

  • still occurring when I put cache: false in my nyc config

Environment Information

  System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 1.87 GB / 32.00 GB
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    npm: 7.11.1 - /usr/local/bin/npm
  npmPackages:
    nyc: ^15.1.0 => 15.1.0 
    typescript: ^4.2.2 => 4.3.2 
@svkr2k
Copy link

svkr2k commented Aug 4, 2021

Hello all, I'm also facing the same issue.
Also not able to instrument the classes (in angular) with decorators @Injectable() in it.
Please help.

@rishi1117
Copy link

heyy @gnzzz @svkr2k have you got anything to resolve this issue ?? I am also stuck on this.

@samarpanB
Copy link

Is there any progress on this issue ? Its very easily reproducible on any angular project. I would like to upvote this issue. It has been open for quite some time now.

@ssuparna2010
Copy link

Please advise if this issue is resolved.. am still having this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants