Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !2738

Add “node” to Jest's moduleFileExtensions

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/mostafah/jest-module-extensions into master Jul 07, 2017
  • Overview 5
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: mostafah

Jest’s default value for its moduleFileExtensions option is ["js", "json", "jsx", "node"]. CRA was not using this option before version 1.0.8, so this default list was used.

PR #2511 (merged in version 1.0.8) sets this option to ["web.js", "js", "json", "web.jsx", "jsx"]. The PR is about adding .web extensions, but it is also removing .node because it is not included like other default extensions.

Why is this a bug?

Packages using native code through node-gyp import files with .node extension. Using those packages fails the tests with a Cannot find module … error.

screen shot 1396-04-16 at 10 09 13

This used to work with version 1.0.7.

Reproduction and testing

This repo is a minimal reproduction of this bug. Tests fail there. Changing react-scripts to 1.0.7 or manually applying this change to node_modules/react-scripts/scripts/utils/createJestConfig.js fixes the problem.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/mostafah/jest-module-extensions