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

Failing to load a module does not fail the test suite #280

Closed
jehon opened this issue Nov 9, 2020 · 1 comment
Closed

Failing to load a module does not fail the test suite #280

jehon opened this issue Nov 9, 2020 · 1 comment

Comments

@jehon
Copy link

jehon commented Nov 9, 2020

Using karma with jasmine.

Expected Behavior

When loading modules, if one module has an error in it (example: it could not import another module due to a typo in the import statement), the test should fail:

Example code:

import { something } from './somewhere.js';

describe...

If "somewhere.js" does not exists, the test should fail.

Current Behavior

Today, the test pass, skipping the "failing-test.js" as it did not exists.
=> It shows:

09 11 2020 11:52:49.258:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
09 11 2020 11:52:49.259:INFO [launcher]: Launching browsers ChromiumHeadless with concurrency unlimited
09 11 2020 11:52:49.263:INFO [launcher]: Starting browser ChromiumHeadless
09 11 2020 11:52:49.542:INFO [Chrome Headless 86.0.4240.183 (Linux x86_64)]: Connected on socket pCX5O55W4Zk2P-JAAAAA with id 38747259
==> 09 11 2020 11:52:49.592:WARN [web-server]: 404: /base/tests/something.js
Chrome Headless 86.0.4240.183 (Linux x86_64): Executed 1 of 1 SUCCESS (0.003 secs / 0.001 secs)
TOTAL: 1 SUCCESS

While obviously, the second test did not run and should be in error

Possible Solution

When importing a test file, it should catch the error:

import('failing-test.js')
  .then(
      () => jasmine current behavior,
      () => the file failed to load, it should fail  the test
  ),

Suite that reproduces the behavior (for bugs)

See https://github.com/jehon/example-jasmine for a bare minimal example

Your Environment

  • karma-jasmine: 4.0.1
  • karma: 5.2.3
  • Jasmine-core: 3.6.0
  • Environment name and version (e.g. ChromiumHeadless 86.0.4240.183 , node.js 4.14.0):
  • Operating System and version : seen in Ubuntu 20
  • Link to your project: https://github.com/jehon/example-jasmine (!! it is currently configured with chromium !!)

Reported initially at jasmine/jasmine#1865 , but redirected here.

@jehon
Copy link
Author

jehon commented Nov 13, 2020

Redirecting to karma-runner/karma#3572

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant