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

chore: upgrade to glob v10 #14509

Merged
merged 9 commits into from Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -54,6 +54,7 @@
- `[*]` [**BREAKING**] Drop support for `typescript@4.3`, minimum version is now `5.0` ([#14542](https://github.com/facebook/jest/pull/14542))
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
- `[*]` [**BREAKING**] Add ESM wrapper for all of Jest's modules ([#14661](https://github.com/jestjs/jest/pull/14661))
- `[*]` [**BREAKING**] Upgrade to `glob@10` ([#14509](https://github.com/jestjs/jest/pull/14509))
- `[docs]` Fix typos in `CHANGELOG.md` and `packages/jest-validate/README.md` ([#14640](https://github.com/jestjs/jest/pull/14640))
- `[docs]` Don't use alias matchers in docs ([#14631](https://github.com/facebook/jest/pull/14631))
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -44,7 +44,7 @@
"eslint-plugin-unicorn": "^50.0.0",
"execa": "^5.0.0",
"find-process": "^1.4.1",
"glob": "^10.0.0",
"glob": "^10.3.10",
"graceful-fs": "^4.2.9",
"isbinaryfile": "^5.0.0",
"istanbul-lib-coverage": "^3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-config/package.json
Expand Up @@ -38,7 +38,7 @@
"chalk": "^4.0.0",
"ci-info": "^4.0.0",
"deepmerge": "^4.2.2",
"glob": "^7.1.3",
"glob": "^10.3.10",
"graceful-fs": "^4.2.9",
"jest-circus": "workspace:*",
"jest-environment-node": "workspace:*",
Expand All @@ -55,7 +55,6 @@
"strip-json-comments": "^3.1.1"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.3",
"@types/micromatch": "^4.0.1",
"@types/parse-json": "^4.0.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-config/src/normalize.ts
Expand Up @@ -10,7 +10,7 @@ import {totalmem} from 'os';
import * as path from 'path';
import chalk = require('chalk');
import merge = require('deepmerge');
import {sync as glob} from 'glob';
import {glob} from 'glob';
import {statSync} from 'graceful-fs';
import micromatch = require('micromatch');
import type {Config} from '@jest/types';
Expand Down Expand Up @@ -755,7 +755,9 @@ export default async function normalize(
// We expand it to these paths. If not, we keep the original path
// for the future resolution.
const globMatches =
typeof project === 'string' ? glob(project) : [];
typeof project === 'string'
? glob.sync(project, {windowsPathsNoEscape: true})
: [];
return projects.concat(
globMatches.length > 0 ? globMatches : project,
);
Expand Down
3 changes: 1 addition & 2 deletions packages/jest-reporters/package.json
Expand Up @@ -24,7 +24,7 @@
"chalk": "^4.0.0",
"collect-v8-coverage": "^1.0.0",
"exit": "^0.1.2",
"glob": "^7.1.3",
"glob": "^10.3.10",
"graceful-fs": "^4.2.9",
"istanbul-lib-coverage": "^3.0.0",
"istanbul-lib-instrument": "^6.0.0",
Expand All @@ -43,7 +43,6 @@
"@jest/test-utils": "workspace:*",
"@tsd/typescript": "^5.0.4",
"@types/exit": "^0.1.30",
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.3",
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-lib-instrument": "^1.7.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-reporters/src/CoverageReporter.ts
Expand Up @@ -9,7 +9,7 @@ import * as path from 'path';
import {mergeProcessCovs} from '@bcoe/v8-coverage';
import type {EncodedSourceMap} from '@jridgewell/trace-mapping';
import chalk = require('chalk');
import glob = require('glob');
import {glob} from 'glob';
import * as fs from 'graceful-fs';
import istanbulCoverage = require('istanbul-lib-coverage');
import istanbulReport = require('istanbul-lib-report');
Expand Down Expand Up @@ -296,7 +296,7 @@ export default class CoverageReporter extends BaseReporter {
// of execution time.
if (filesByGlob[absoluteThresholdGroup] === undefined) {
filesByGlob[absoluteThresholdGroup] = glob
.sync(absoluteThresholdGroup)
.sync(absoluteThresholdGroup, {windowsPathsNoEscape: true})
.map(filePath => path.resolve(filePath));
}

Expand Down
3 changes: 1 addition & 2 deletions packages/jest-runtime/package.json
Expand Up @@ -30,7 +30,7 @@
"chalk": "^4.0.0",
"cjs-module-lexer": "^1.0.0",
"collect-v8-coverage": "^1.0.0",
"glob": "^7.1.3",
"glob": "^10.3.10",
"graceful-fs": "^4.2.9",
"jest-haste-map": "workspace:*",
"jest-message-util": "workspace:*",
Expand All @@ -44,7 +44,6 @@
},
"devDependencies": {
"@jest/test-utils": "workspace:*",
"@types/glob": "^7.1.1",
"@types/graceful-fs": "^4.1.3",
"jest-environment-node": "workspace:*"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-runtime/src/helpers.ts
Expand Up @@ -6,7 +6,7 @@
*/

import * as path from 'path';
import glob = require('glob');
import {glob} from 'glob';
import slash = require('slash');
import type {Config} from '@jest/types';

Expand Down Expand Up @@ -42,7 +42,7 @@ export const findSiblingsWithFileExtension = (
const slashedDirname = slash(dirname);

const matches = glob
.sync(`${pathToModule}.*`)
.sync(`${pathToModule}.*`, {windowsPathsNoEscape: true})
.map(match => slash(match))
.map(match => {
const relativePath = path.posix.relative(slashedDirname, match);
Expand Down
30 changes: 5 additions & 25 deletions yarn.lock
Expand Up @@ -3045,7 +3045,7 @@ __metadata:
eslint-plugin-unicorn: ^50.0.0
execa: ^5.0.0
find-process: ^1.4.1
glob: ^10.0.0
glob: ^10.3.10
graceful-fs: ^4.2.9
isbinaryfile: ^5.0.0
istanbul-lib-coverage: ^3.0.0
Expand Down Expand Up @@ -3101,7 +3101,6 @@ __metadata:
"@jridgewell/trace-mapping": ^0.3.18
"@tsd/typescript": ^5.0.4
"@types/exit": ^0.1.30
"@types/glob": ^7.1.1
"@types/graceful-fs": ^4.1.3
"@types/istanbul-lib-coverage": ^2.0.0
"@types/istanbul-lib-instrument": ^1.7.2
Expand All @@ -3113,7 +3112,7 @@ __metadata:
chalk: ^4.0.0
collect-v8-coverage: ^1.0.0
exit: ^0.1.2
glob: ^7.1.3
glob: ^10.3.10
graceful-fs: ^4.2.9
istanbul-lib-coverage: ^3.0.0
istanbul-lib-instrument: ^6.0.0
Expand Down Expand Up @@ -5142,16 +5141,6 @@ __metadata:
languageName: node
linkType: hard

"@types/glob@npm:^7.1.1":
version: 7.2.0
resolution: "@types/glob@npm:7.2.0"
dependencies:
"@types/minimatch": "*"
"@types/node": "*"
checksum: 6ae717fedfdfdad25f3d5a568323926c64f52ef35897bcac8aca8e19bc50c0bd84630bbd063e5d52078b2137d8e7d3c26eabebd1a2f03ff350fff8a91e79fc19
languageName: node
linkType: hard

"@types/graceful-fs@npm:^4.1.3":
version: 4.1.9
resolution: "@types/graceful-fs@npm:4.1.9"
Expand Down Expand Up @@ -5342,13 +5331,6 @@ __metadata:
languageName: node
linkType: hard

"@types/minimatch@npm:*":
version: 5.1.2
resolution: "@types/minimatch@npm:5.1.2"
checksum: 0391a282860c7cb6fe262c12b99564732401bdaa5e395bee9ca323c312c1a0f45efbf34dce974682036e857db59a5c9b1da522f3d6055aeead7097264c8705a8
languageName: node
linkType: hard

"@types/ms@npm:*":
version: 0.7.34
resolution: "@types/ms@npm:0.7.34"
Expand Down Expand Up @@ -11035,7 +11017,7 @@ __metadata:
languageName: node
linkType: hard

"glob@npm:^10.0.0, glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7":
"glob@npm:^10.2.2, glob@npm:^10.3.10, glob@npm:^10.3.7":
version: 10.3.10
resolution: "glob@npm:10.3.10"
dependencies:
Expand Down Expand Up @@ -12915,15 +12897,14 @@ __metadata:
"@babel/core": ^7.11.6
"@jest/test-sequencer": "workspace:*"
"@jest/types": "workspace:*"
"@types/glob": ^7.1.1
"@types/graceful-fs": ^4.1.3
"@types/micromatch": ^4.0.1
"@types/parse-json": ^4.0.0
babel-jest: "workspace:*"
chalk: ^4.0.0
ci-info: ^4.0.0
deepmerge: ^4.2.2
glob: ^7.1.3
glob: ^10.3.10
graceful-fs: ^4.2.9
jest-circus: "workspace:*"
jest-environment-node: "workspace:*"
Expand Down Expand Up @@ -13319,13 +13300,12 @@ __metadata:
"@jest/test-utils": "workspace:*"
"@jest/transform": "workspace:*"
"@jest/types": "workspace:*"
"@types/glob": ^7.1.1
"@types/graceful-fs": ^4.1.3
"@types/node": "*"
chalk: ^4.0.0
cjs-module-lexer: ^1.0.0
collect-v8-coverage: ^1.0.0
glob: ^7.1.3
glob: ^10.3.10
graceful-fs: ^4.2.9
jest-environment-node: "workspace:*"
jest-haste-map: "workspace:*"
Expand Down