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
  • Issues
  • #6038
Closed
Open
Issue created Dec 14, 2018 by Administrator@rootContributor

windows 7 create-react-app eject jest fails

Created by: mrLucianoii

Is this a bug report?

Yes

Which terms did you search for in User Guide?

create-react-app eject jest fails windows

Environment

System: OS: Windows 7 Binaries: Node: v8.11.1 Yarn: 1.12.1 npm: 5.6.0 Browsers: npmPackages: react: ^16.6.3 => 16.6.3 react-dom: ^16.6.3 => 16.6.3 react-scripts: 2.1.1 => 2.1.1 npmGlobalPackages:

Steps to Reproduce

(Write your steps here:)

  1. Create an app on windows --> $ npx create-react-app my-app-test
  2. Run --> $ yarn test
  3. Tests work, with no 'Jest encountered an unexpected token'
  4. Run --> $ yarn eject
  5. an error is logged upon ejecting
[3/4] Linking dependencies...
{color:red}error {color}An unexpected error occurred: "EPERM: operation not permitted, unlink 'I:\\testing\\my-app\\node_modules\\.cache\\babel-loader'".*

For the above error, I have deleted my npm_modules folder, cleared cache, then reinstalled, and linking dependencies did pass without errors. I'm don't think this is related at this point.

  1. Terminal logs ejected successfully, however when we now run $ yarn test

Expected Behavior

Yarn test should pass.

Actual Behavior

(master)
$ yarn test
yarn run v1.12.1
$ node scripts/test.js
 FAIL  C:/Users/user/Scratch/testing/my-app/src/App.test.js
  ● Test suite failed to run

    Jest encountered an unexpected token

    This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.

    By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".

    Here's what you can do:
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/en/configuration.html

    Details:

    SyntaxError: C:\Users\usr\Scratch\testing\my-app\src\App.test.js: Unexpected token (7:18)

       5 | it('renders without crashing', () => {
       6 |   const div = document.createElement('div');
    >  7 |   ReactDOM.render(<App />, div);
         |                   ^
       8 |   ReactDOM.unmountComponentAtNode(div);
       9 | });
      10 |

      at Parser.raise (node_modules/@babel/parser/lib/index.js:3939:15)
      at Parser.unexpected (node_modules/@babel/parser/lib/index.js:5248:16)
      at Parser.parseExprAtom (node_modules/@babel/parser/lib/index.js:6328:20)
      at Parser.parseExprSubscripts (node_modules/@babel/parser/lib/index.js:5924:21)
      at Parser.parseMaybeUnary (node_modules/@babel/parser/lib/index.js:5903:21)
      at Parser.parseExprOps (node_modules/@babel/parser/lib/index.js:5812:21)
      at Parser.parseMaybeConditional (node_modules/@babel/parser/lib/index.js:5784:21)
      at Parser.parseMaybeAssign (node_modules/@babel/parser/lib/index.js:5731:21)
      at Parser.parseExprListItem (node_modules/@babel/parser/lib/index.js:7003:18)
      at Parser.parseCallExpressionArguments (node_modules/@babel/parser/lib/index.js:6124:22)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        5.011s
Ran all test suites.

Reproducible Demo

I'm using create-react-app right out of the box. It works on my Apple fine, but not on Windows 7.

Assignee
Assign to
Time tracking