Skip to content

Commit

Permalink
Roll back micromatch (#6661)
Browse files Browse the repository at this point in the history
## Summary

As part of #6400, `micromatch` was updated.  While `micromatch`'s CHANGELOG claims that this is safe, several regressions have been noted in cases where users relied upon invalid glob patterns.  For example, these patterns would all match `src/foo/bar/baz.js`, but no longer do:

 - `src/**/*.{js}`
 - `src/**.js`
 - `src/**/*.{js|ts}`

Fixes #6563
Fixes #6546

## Test plan

Unit tests were added which demonstrate the known cases.
  • Loading branch information
Tvrqvoise authored and thymikee committed Jul 9, 2018
1 parent fa92643 commit e930c70
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- `[jest-cli]` properly reprint resolver errors in watch mode ([#6407](https://github.com/facebook/jest/pull/6407))
- `[jest-cli]` Write configuration to stdout when the option was explicitly passed to Jest ([#6447](https://github.com/facebook/jest/pull/6447))
- `[jest-cli]` Fix regression on non-matching suites ([6657](https://github.com/facebook/jest/pull/6657))
- `[jest-runtime]` Roll back `micromatch` version to prevent regression when matching files ([#6661](https://github.com/facebook/jest/pull/6661))

## 23.3.0

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"karma-mocha": "^1.3.0",
"left-pad": "^1.1.1",
"lerna": "2.11.0",
"micromatch": "^3.1.10",
"micromatch": "^2.3.11",
"mkdirp": "^0.5.1",
"mocha": "^5.0.1",
"mock-fs": "^4.4.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"jest-validate": "^23.3.0",
"jest-watcher": "^23.2.0",
"jest-worker": "^23.2.0",
"micromatch": "^3.1.10",
"micromatch": "^2.3.11",
"node-notifier": "^5.2.1",
"prompts": "^0.1.9",
"realpath-native": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"jest-docblock": "^23.2.0",
"jest-serializer": "^23.0.1",
"jest-worker": "^23.2.0",
"micromatch": "^3.1.10",
"micromatch": "^2.3.11",
"sane": "^2.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/jest-message-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@babel/code-frame": "^7.0.0-beta.35",
"chalk": "^2.0.1",
"micromatch": "^3.1.10",
"micromatch": "^2.3.11",
"slash": "^1.0.0",
"stack-utils": "^1.0.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"jest-snapshot": "^23.3.0",
"jest-util": "^23.3.0",
"jest-validate": "^23.3.0",
"micromatch": "^3.1.10",
"micromatch": "^2.3.11",
"realpath-native": "^1.0.0",
"slash": "^1.0.0",
"strip-bom": "3.0.0",
Expand Down
16 changes: 16 additions & 0 deletions packages/jest-runtime/src/__tests__/should_instrument.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ describe('should_instrument', () => {
);
});

it('should should match invalid globs, to be removed in the next major', () => {
const testSingleCollectCoverageFrom = pattern =>
testShouldInstrument(
'do/collect/coverage.js',
{
collectCoverage: true,
collectCoverageFrom: [pattern],
},
defaultConfig,
);

testSingleCollectCoverageFrom('**/do/**/*.{js}');
testSingleCollectCoverageFrom('**/do/**/*.{js|ts}');
testSingleCollectCoverageFrom('**/do/**.js');
});

it('should return true if the file is not in coveragePathIgnorePatterns', () => {
testShouldInstrument('do/collect/coverage.js', defaultOptions, {
coveragePathIgnorePatterns: ['dont'],
Expand Down

0 comments on commit e930c70

Please sign in to comment.