[beta] warns the user if jest config transform matches js files without allowJs in tsconfig#724
Merged
huafu merged 2 commits intokulshekhar:betafrom Sep 18, 2018
Merged
Conversation
Pull Request Test Coverage Report for Build 1817
💛 - Coveralls |
kulshekhar
reviewed
Sep 18, 2018
| if (filePath.endsWith('.d.ts')) { | ||
| // do not try to compile declaration files | ||
| result = '' | ||
| } else if (!configs.typescript.options.allowJs && filePath.endsWith('.js')) { |
Owner
There was a problem hiding this comment.
should this also check for .jsx?
kulshekhar
approved these changes
Sep 18, 2018
huafu
commented
Sep 18, 2018
| it('should return stringified version of file', () => { | ||
| config.shouldStringifyContent.mockImplementation(() => true) | ||
| expect(process()).toMatchInlineSnapshot(`"ts:module.exports=\\"export default \\\\\\"foo\\\\\\"\\""`) | ||
| expect(process()).toMatchInlineSnapshot(`"module.exports=\\"export default \\\\\\"foo\\\\\\"\\""`) |
Collaborator
Author
There was a problem hiding this comment.
this was actually a tiny "bug", files which should be transformed into modules returning their content were then going thru typescript, which was not needed at all, but not failing of course
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Given a jest config with:
and a
tsconfig.jsonwhereallowJscompiler option is missing or set tofalse,ts-jestwill be given.jsfiles even tho it's not supposed to process them. TypeScript would bail in that case.This PR make it so that input js code from
.jsfiles is returned unmodified (in the above described case), and a warning message is shown.This kinda fixes confusions made such as in #721