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

Make --all flag work with files with extensions other than .js #326

Merged
merged 4 commits into from
Jul 24, 2016
Merged

Make --all flag work with files with extensions other than .js #326

merged 4 commits into from
Jul 24, 2016

Conversation

rundef
Copy link
Contributor

@rundef rundef commented Jul 22, 2016

I'm using TypeScript for a project, and when I run nyc with the --all flag, I keep getting errors such as:

failed to instrument /microservices/ms-gateway/app/entities/UserEndpoint.ts with error: 'import' and 'export' may appear only with 'sourceType: module' (1:0)

My package.json config looks like this:

"nyc": {
    "include": [
      "app/*.ts",
      "app/**/*.ts"
    ],
    "extension": [
      ".ts"
    ],
    "require": [
      "ts-node/register"
    ]
  }

It happens because under the hood, the code was trying to instrument the TypeScript code rather than the transpiled JavaScript code.

@coveralls
Copy link

coveralls commented Jul 22, 2016

Coverage Status

Changes Unknown when pulling 3798d4a on rundef:master into * on istanbuljs:master*.

@rundef
Copy link
Contributor Author

rundef commented Jul 22, 2016

Sorry about all the commits, the tests weren't working here - for some reason, the test 027 doesn't pass on my computer

@bcoe
Copy link
Member

bcoe commented Jul 22, 2016

@rundef great catch;

I'm curious why your local tests are failing! might be worth digging into more.

I'll be putting out some releases tonight and tomorrow, and will make sure to land this.

@rundef
Copy link
Contributor Author

rundef commented Jul 22, 2016

The test was failing because I didn't have write access to node_modules/.cache
Now everything is working fine !

@bcoe bcoe merged commit d0a8674 into istanbuljs:master Jul 24, 2016
@bcoe
Copy link
Member

bcoe commented Jul 24, 2016

@rundef I've also landed this change in next, if you wouldn't mind giving it a shot:

npm cache clear; npm i nyc@next

when you have a moment, and are bored, would love a follow up unit test at some point -- just so we never have a regression of this feature.

@bcoe
Copy link
Member

bcoe commented Jul 25, 2016

@rundef I've actually promoted this to latest.

npm cache clear; npm i nyc should have your changes.

@rundef
Copy link
Contributor Author

rundef commented Jul 25, 2016

Thanks, it works perfectly for me now.
I will send a unit test for that feature later this week, when I have some free time.

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

Successfully merging this pull request may close these issues.

3 participants