Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File valid_path/karma.conf.js does not exist! #3339

Closed
NothingEverHappens opened this issue Jul 14, 2019 · 0 comments · Fixed by #3345 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201
Closed

File valid_path/karma.conf.js does not exist! #3339

NothingEverHappens opened this issue Jul 14, 2019 · 0 comments · Fixed by #3345 or karronoli/redpen#10 · May be fixed by Omrisnyk/npm-lockfiles#201

Comments

@NothingEverHappens
Copy link

Expected behaviour

When I run karma, I get message valid_path/karma.conf.js, while the file it certainly there.

Actual behaviour

The error happens in this file:

if (e.code === 'MODULE_NOT_FOUND' && e.message.includes(configFilePath)) {

File gets required successfully, but contains an inner require which fails.
Error handler sees the error type as MODULE_NOT_FOUND, but assumes that it's for outer, not inner require.

There's is actually a test for this:
&& e.message.includes(configFilePath)

But it fails because the path is in stack trace, which is part of the message.

Require stack:
- valid_path/karma.conf.js
....

Environment Details

  • Karma version (output of karma --version):
    Karma version: 3.1.4
  • Relevant part of your karma.config.js file
require('I do not exist');

Steps to reproduce the behaviour

  1. create karma.conf.js, inside do:
require('I do not exist');
  1. start karma
  2. Get an error saying karma.config.js does not exist.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment