jest: Error running jest tests on jest master branch

Hey guys,

I am planing to make a PR but for some reason I am getting a lot of errors running jest tests in the master branch on a clean clone:

yarn test v0.17.8
$ yarn typecheck && yarn lint && yarn jest 
yarn typecheck v0.17.8
$ flow check --include-warnings 
Error: packages/babel-jest/src/index.js:16
 16: import jestPreset from 'babel-preset-jest';
                            ^^^^^^^^^^^^^^^^^^^ babel-preset-jest. Required module not found

Error: packages/babel-jest/src/index.js:18
 18: import babelIstanbulPlugin from 'babel-plugin-istanbul';
                                     ^^^^^^^^^^^^^^^^^^^^^^^ babel-plugin-istanbul. Required module not found

Error: packages/jest-changed-files/src/index.js:15
 15: import throat from 'throat';
                        ^^^^^^^^ throat. Required module not found

Error: packages/jest-circus/src/format_node_assert_errors.js:10
 10: import type {DiffOptions} from 'jest-diff/src/diff_strings.js';
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ jest-diff/src/diff_strings.js. Required module not found

Error: packages/jest-circus/src/legacy_code_todo_rewrite/jest_adapter_init.js:14
 14: import {extractExpectedAssertionsErrors, getState, setState} from 'expect';
                                                                       ^^^^^^^^ expect. Required module not found

Error: packages/jest-circus/src/legacy_code_todo_rewrite/jest_expect.js:12
 12: import expect from 'expect';
                        ^^^^^^^^ expect. Required module not found

Error: packages/jest-cli/src/cli/index.js:25
 25: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-cli/src/cli/index.js:36
 36: import {sync as realpath} from 'realpath-native';
                                    ^^^^^^^^^^^^^^^^^ realpath-native. Required module not found

Error: packages/jest-cli/src/reporters/coverage_worker.js:12
 12: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-cli/src/reporters/notify_reporter.js:14
 14: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-cli/src/reporters/notify_reporter.js:17
 17: import notifier from 'node-notifier';
                          ^^^^^^^^^^^^^^^ node-notifier. Required module not found

Error: packages/jest-cli/src/run_jest.js:19
 19: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-cli/src/test_scheduler.js:24
 24: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-cli/src/watch.js:17
 17: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-docblock/src/index.js:10
 10: import detectNewline from 'detect-newline';
                               ^^^^^^^^^^^^^^^^ detect-newline. Required module not found

Error: packages/jest-environment-jsdom/src/index.js:17
 17: import {JSDOM, VirtualConsole} from 'jsdom';
                                         ^^^^^^^ jsdom. Required module not found

Error: packages/jest-haste-map/src/crawlers/watchman.js:15
 15: import watchman from 'fb-watchman';
                          ^^^^^^^^^^^^^ fb-watchman. Required module not found

Error: packages/jest-haste-map/src/index.js:32
 32: import sane from 'sane';
                      ^^^^^^ sane. Required module not found

Error: packages/jest-jasmine2/src/assert_support.js:10
 10: import type {DiffOptions} from 'jest-diff/src/diff_strings';
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ jest-diff/src/diff_strings. Required module not found

Error: packages/jest-jasmine2/src/jasmine_async.js:17
 17: import isGeneratorFn from 'is-generator-fn';
                               ^^^^^^^^^^^^^^^^^ is-generator-fn. Required module not found

Error: packages/jest-jasmine2/src/jest_expect.js:12
 12: import expect from 'expect';
                        ^^^^^^^^ expect. Required module not found

Error: packages/jest-jasmine2/src/setup_jest_globals.js:13
 13: import {extractExpectedAssertionsErrors, getState, setState} from 'expect';
                                                                       ^^^^^^^^ expect. Required module not found

Error: packages/jest-leak-detector/src/index.js:41
 41:       weak = require('weak');
                          ^^^^^^ weak. Required module not found

Error: packages/jest-message-util/src/index.js:18
 18: import {codeFrameColumns} from '@babel/code-frame';
                                    ^^^^^^^^^^^^^^^^^^^ @babel/code-frame. Required module not found

Error: packages/jest-message-util/src/index.js:19
 19: import StackUtils from 'stack-utils';
                            ^^^^^^^^^^^^^ stack-utils. Required module not found

Error: packages/jest-runner/src/index.js:22
 22: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-runner/src/index.js:24
 24: import throat from 'throat';
                        ^^^^^^^^ throat. Required module not found

Error: packages/jest-runner/src/test_worker.js:14
 14: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-runtime/src/cli/index.js:14
 14: import exit from 'exit';
                      ^^^^^^ exit. Required module not found

Error: packages/jest-runtime/src/script_transformer.js:23
 23: import babelPluginIstanbul from 'babel-plugin-istanbul';
                                     ^^^^^^^^^^^^^^^^^^^^^^^ babel-plugin-istanbul. Required module not found

Error: packages/jest-runtime/src/script_transformer.js:31
 31: import {sync as realpath} from 'realpath-native';
                                    ^^^^^^^^^^^^^^^^^ realpath-native. Required module not found

Error: packages/jest-validate/src/utils.js:12
 12: import leven from 'leven';
                       ^^^^^^^ leven. Required module not found

Error: packages/jest-worker/src/index.js:12
 12: import mergeStream from 'merge-stream';
                             ^^^^^^^^^^^^^^ merge-stream. Required module not found

Error: packages/jest/src/jest.js:10
 10: import cli from 'jest-cli';
                     ^^^^^^^^^^ jest-cli. Required module not found

Error: types/TestRunner.js:20
 20: import type {TestWatcher as _TestWatcher} from 'jest-cli';
                                                    ^^^^^^^^^^ jest-cli. Required module not found


Found 35 errors
error Command failed with exit code 2.
error Command failed with exit code 1.

Node version: v8.9.4, yarn version: 0.17.8

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@varunsharma27 this issue is about running Jest’s own unit tests on the master branch of Jest. If you are using Jest in another project, then this issue is not related at all to the issue you’re experiencing.

However, Jest does work, so it’s something with your setup. We recommend using StackOverflow or our discord channel for questions.