Skip to content

jest Error "test.each is not a function" #4845

@eins78

Description

@eins78

Is this a bug report?

(write your answer here)

Yes.

Did you try recovering your dependencies?

Yes, tried it with a newly created project.

Which terms did you search for in User Guide?

jest, .each

Environment

Environment: OS: macOS High Sierra 10.13.6 Node: 8.9.2 Yarn: 1.7.0 npm: 6.2.0 Watchman: 4.9.0 Xcode: Xcode 9.4.1 Build version 9F2000 Android Studio: Not Found Packages: (wanted => installed) react: ^16.4.2 => 16.4.2 react-dom: ^16.4.2 => 16.4.2 react-scripts: 1.1.4 => 1.1.4 

Steps to Reproduce

npx create-react-app jest-each-bug cd jest-each-bug/ echo 'test.each([1])('t', a => expect(a).toBe(1))' > src/some.test.js CI=true npm run test

Expected Behavior

Test should run.

Actual Behavior

💣 TypeError: test.each is not a function

console output

> jest-each-bug@0.1.0 test /private/tmp/jest-each-bug > react-scripts test --env=jsdom PASS src/App.test.js FAIL src/some.test.js ● Test suite failed to run TypeError: test.each is not a function at Object.<anonymous> (src/some.test.js:1:108) at <anonymous> Test Suites: 1 failed, 1 passed, 2 total Tests: 1 passed, 1 total Snapshots: 0 total Time: 1.129s Ran all test suites. 

Reproducible Demo

See "Steps to Reproduce" above, creates demo project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions