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

Fix npm test file matching on Windows #169

Merged
merged 2 commits into from
Jun 15, 2019

Conversation

ParkerM
Copy link
Member

@ParkerM ParkerM commented Jun 11, 2019

The matching pattern jest --coverage test/*.test.js no longer works with npm test on Windows (see jestjs/jest#6650). The default glob pattern in jest.config.js matches the same files in both environments, so it shouldn't be needed in the npm test script.

I also added mockCache.js to coveragePathIgnorePatterns so it would stop showing up in coverage reports.

Before (click for logs)

$ npm test

> openjdk-api@1.0.0 test C:\Users\<mypath>\openjdk-api
> jest --coverage test/*.test.js && npm run lint

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\<mypath>\openjdk-api
  37 files checked.
  testMatch: **/__tests__/**/*.[jt]s?(x),**/?(*.)+(spec|test).[tj]s?(x) - 2 matches
  testPathIgnorePatterns: \\node_modules\\ - 37 matches
  testRegex:  - 37 matches
Pattern: test\\*.test.js - 0 matches
npm ERR! Test failed.  See above for more details.

After (click for logs)

$ npm test

> openjdk-api@1.0.0 test C:\Users\<mypath>\openjdk-api
> jest --coverage && npm run lint

PASS test/versions.test.js
PASS test/v2.test.js
  ● Console

    console.log app/lib/github_file_cache.js:17
      Reading auth

-----------------------|----------|----------|----------|----------|-------------------|
File                   |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------------|----------|----------|----------|----------|-------------------|
All files              |    78.41 |    75.16 |    84.69 |    78.16 |                   |
 lib                   |       50 |       40 |    36.84 |       50 |                   |
  github_file_cache.js |       50 |       40 |    36.84 |       50 |... 55,166,167,179 |
 routes                |    85.46 |    81.82 |     96.2 |    85.25 |                   |
  v2.js                |    83.13 |    78.95 |    95.71 |    82.85 |... 42,543,545,546 |
  versions.js          |      100 |      100 |      100 |      100 |                   |
-----------------------|----------|----------|----------|----------|-------------------|

Test Suites: 2 passed, 2 total
Tests:       129 passed, 129 total
Snapshots:   0 total
Time:        3.088s
Ran all test suites.

> openjdk-api@1.0.0 lint C:\Users\<mypath>\openjdk-api
> eslint *.js app/routes/*.js

@karianna karianna added this to the v3 milestone Jun 15, 2019
@karianna karianna added the bug label Jun 15, 2019
@karianna karianna self-requested a review June 15, 2019 11:41
Copy link
Member

@karianna karianna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@karianna karianna merged commit f58f362 into AdoptOpenJDK:master Jun 15, 2019
@ParkerM ParkerM deleted the npm-test-fix branch June 15, 2019 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants