karma-runner / karma-runner/karma

Feature: Option to make test run fail if there is a 404

Open
#3,442 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

### Expected behaviour
If there is a 404, the Karma process should (optionally) fail.

### Actual behaviour
If there is a 404, it is just logged.

### Environment Details

- Karma version (output of `karma --version`): all
- Relevant part of your `karma.config.js` file

### Steps to reproduce the behaviour
- Specify a file that does not exist in the karma.conf file.
- Import a file that does not exist into a source file or a spec file.
- Incorrectly configure your proxies.
- Put a typo in one of the files you are trying to list.
- Rename a specified file but fail to update the config file.

The main reason this is an issue is that it allows failures to be silent. In my case, I have correctly configured my proxies, so every time there is a 404, it means that there is a mistake in my source code. It is not good CI/CD to have to manually scroll through my test output to check for 404s rather than having the test simply fail.

I think, ideally, this is an option that would take arrays of patterns, similar to "exclude". For example, a user might want to have only files matching the patterns `*.js` or `*.css` throw an error on 404, but allow image files to have a 404 without consequence.

Contributor guide

Open the contributing guide

Research direction

Start with the 404 behavior triggered by missing files in karma.conf.js, imported source or spec files, and configured proxies. Trace how those requests are logged and how configuration options are read, then define the pattern-matching option and verify that selected 404s fail the test run while excluded resources do not.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.