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

feat: add option to run TypeScript diagnostics #427

Merged
merged 4 commits into from
Feb 3, 2018

Conversation

alan-agius4
Copy link
Contributor

By creating a program we are enabled to run diagnostics on typescipt files in order to emit semantic errors. For the time being I only used one of the many methods this one is getPreEmitDiagnostics

This enables syntactic & semantic TypeScript error reporting

@kulshekhar
Copy link
Owner

@alan-agius4 Thanks for taking the time to create the PR :)

I just have one question - is ts-jest the right place for this? It sounds like something that should be done via an npm script using tsc.

Also, should this discussion result in merging, all tests (currently failing) will need to pass.

By creating a `program` we are enabled to run diagnostics on typescipt files in order to emit semantic errors. For the time being I only used one of the many methods this one is `getPreEmitDiagnostics`

This enables syntactic & semantic TypeScript error reporting
@alan-agius4 alan-agius4 reopened this Feb 3, 2018
@alan-agius4
Copy link
Contributor Author

alan-agius4 commented Feb 3, 2018

Test have been fixed.

Well, as a matter of fact I actually did expect this was provided by ts-jest and on by default and maybe a lot of people think the same, they just never realized it doesn't, and I have used ts-jest for some time now, but only recently noticed that this is not supported.

I used Karma before and still do now. and for Karma users this is something that comes out side of the box if you use the typescript plugin. Having it as an npm script it's a possibility but like that you'll lose the benefits of jest caching and also having to run a npm script to valid your code prior to using ts-jest for me makes ts-jest a bit redundant as than I can use the transpiled JS to run the tests on. For me it doesn't make that much sense to transpile twice especially considering I have a lot of code.

@kulshekhar
Copy link
Owner

I've actually resisted this feature for long but it seems more and more people want it. So I'm okay with this PR.

@alan-agius4 Could you also:

  • bump the version patch in package.json so that this can be published right away
  • update the AUTHORS file with your name/email in alphabetical order?

kulshekhar
kulshekhar previously approved these changes Feb 3, 2018
@alan-agius4
Copy link
Contributor Author

Bumped and added myself to the authers

kulshekhar
kulshekhar previously approved these changes Feb 3, 2018
@alan-agius4
Copy link
Contributor Author

One quick thing, shouldn't the bump be a minor instead of a patch since it's a feature? or you are not following semver?

@kulshekhar
Copy link
Owner

yeah - we don't follow semver. We follow Jest's major version but beyond that it's a bit arbitrary.

@kulshekhar kulshekhar merged commit 8350b4f into kulshekhar:master Feb 3, 2018
@alan-agius4 alan-agius4 deleted the feature/emit-error branch February 3, 2018 12:11
@kulshekhar
Copy link
Owner

Merged and published.

Thanks again for the PR @alan-agius4 😃

@alan-agius4
Copy link
Contributor Author

glad to help 😄

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.

None yet

2 participants