Skip to content

Show error if Jest is used with Karma files

Inactive Account requested to merge winh-jest-wrong-file-error into master

Before

$ yarn jest spec/javascripts/notes/components/note_body_spec.js
yarn run v1.16.0
$ yarn check-dependencies
$ scripts/frontend/check_dependencies.sh
$ jest spec/javascripts/notes/components/note_body_spec.js
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/winnie/Projects/gdk-ee/gitlab
  5739 files checked.
  testMatch: /Users/winnie/Projects/gdk-ee/gitlab/spec/frontend/**/*_spec.js, /Users/winnie/Projects/gdk-ee/gitlab/ee/spec/frontend/**/*_spec.js - 417 matches
  testPathIgnorePatterns: /node_modules/ - 5739 matches
  testRegex:  - 0 matches
Pattern: spec/javascripts/notes/components/note_body_spec.js - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

After

$ yarn jest spec/javascripts/notes/components/note_body_spec.js
yarn run v1.16.0
$ yarn check-dependencies
$ scripts/frontend/check_dependencies.sh
$ jest spec/javascripts/notes/components/note_body_spec.js

Files in spec/javascripts/ and ee/spec/javascripts need to be run with Karma.
Please use the following command instead:

yarn karma -f spec/javascripts/notes/components/note_body_spec.js


error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Merge request reports