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

Update docs re: moduleFileExtensions to add ordering note (left-to-right) #7616

Merged
merged 4 commits into from
Jan 19, 2019

Conversation

jeffgore00
Copy link
Contributor

Adds note that the moduleFileExtensions configuration evaluates the array of file extensions from left-to-right. This may seem self-evident, but personally after dealing with Webpack loaders which work in the opposite direction, I think it doesn't hurt to point out.

See issue #7563 for the original discussion on this matter. If someone is more knowledgable about performance, perhaps we could also add a note that in a TypeScript project, moving the .ts and .tsx extensions to the beginning could be advantageous (per @thymikee).

@facebook-github-bot
Copy link
Contributor

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also update the versioned docs with this notice?

@codecov-io
Copy link

codecov-io commented Jan 12, 2019

Codecov Report

Merging #7616 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7616   +/-   ##
=======================================
  Coverage   68.26%   68.26%           
=======================================
  Files         249      249           
  Lines        9623     9623           
  Branches        5        5           
=======================================
  Hits         6569     6569           
  Misses       3052     3052           
  Partials        2        2

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94c40a5...400f4cc. Read the comment docs.

@jeysal
Copy link
Contributor

jeysal commented Jan 12, 2019

perhaps we could also add a note that in a TypeScript project, moving the .ts and .tsx extensions to the beginning could be advantageous

Yeah I think something like "We recommend placing the extensions most commonly used in your project on the left" would be good, otherwise it might not be immediately obvious to everyone.

@jeffgore00
Copy link
Contributor Author

Thanks @jeysal, I like that wording. That's a simple addition for the current version, but for the versioned docs, @thymikee, I think it's potentially confusing for that sentence which says implementation is dependent on your project to co-exist with the command that "If you are using TypeScript this should be ["js", "jsx", "json", "ts", "tsx"].

So for the versioned docs I suggest this rewrite - let me know what you think:

moduleFileExtensions [array]

Default: ["js", "json", "jsx", "node"]

An array of file extensions your modules use. If you require modules without specifying a file extension, these are the extensions Jest will look for, in left-to-right order.

If you are using TypeScript via ts-jest, you will want to add "ts" and/or "tsx" to above default. Where you place these is up to you - we recommend placing the extensions most commonly used in your project on the left.

@SimenB
Copy link
Member

SimenB commented Jan 15, 2019

@jeffgore00 no reason to bring up "via ts-jest", IMO - just say "If you are using TypeScript, you will...".

Also, could you sign the CLA? 😀

@jeffgore00
Copy link
Contributor Author

Thanks @SimenB - I signed the CLA and made edits to all of the versioned_docs as well.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@SimenB SimenB merged commit 6771bd4 into jestjs:master Jan 19, 2019
thymikee added a commit to thymikee/jest that referenced this pull request Jan 20, 2019
…m-runtime

* upstream/master:
  add missing truncate comment to recent blog posts (jestjs#7655)
  use raw serializer for e2e output snapshots (jestjs#7651)
  chore: use a Set for reserved words list in `jest-mock`
  Fix automock for numeric function names (jestjs#7653)
  Update docs re: `moduleFileExtensions` to add ordering note (left-to-right) (jestjs#7616)
captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
quinnturner added a commit to quinnturner/next.js that referenced this pull request Oct 27, 2020
quinnturner added a commit to quinnturner/next.js that referenced this pull request Oct 27, 2020
quinnturner added a commit to quinnturner/next.js that referenced this pull request Oct 27, 2020
kodiakhq bot pushed a commit to vercel/next.js that referenced this pull request Oct 27, 2020
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants