karma-runner / karma-runner/karma

Testing fails to test certain files

Open
#2,488 4 comments 1 reaction 0 assignees View on GitHub
needs: test
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I am using Karma with a React boiler plate. Testing has been fine so far, but i encountered an issue where Karma simply skips a directory.

The directory is built in the same way as all other tested directories, the only notable difference that I was able to identify was that the length of the path seemed to enable or disable the Testing.

### Expected behaviour
Test directory `backoffice/app/components/bootstrap/atoms/CardDeckWrapper/tests/index.tests.js`

### Actual behaviour
Tests skips the file!

### Steps to reproduce the behaviour

1. Name a directory `CardDeckWrapper`
2. Test --> result Test skipped
3. Rename directory `CDW`
4. Test --> result Tested

My hack right now is to create a directory with a SHORT name (that was kind of funny) `FIX`, in which I `require()` the testing files. This allows me to tests every file, but the bug not allowing Karma to go through directories with long names obviously persists.

### Environment Details

- Karma version 1.0.3:
- Relevant part of your `karma.config.js` file

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `backoffice/app/components/bootstrap/atoms/CardDeckWrapper/tests/index.tests.js` and the shorter `CDW` directory name. Review the relevant `karma.config.js` settings and compare test discovery for both paths. Done means Karma discovers and runs the tests in the long-named directory without the short-directory workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.