From 4b4f2a93d2f449a6d6e3db0e4a382f306d9e903a Mon Sep 17 00:00:00 2001 From: ziebam Date: Thu, 29 Aug 2024 16:08:34 +0200 Subject: [PATCH] Replace `glob` with `tinyglobby` in jest-runtime --- packages/jest-runtime/package.json | 4 ++-- packages/jest-runtime/src/helpers.ts | 5 ++--- packages/jest-runtime/tsconfig.json | 2 +- yarn.lock | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/jest-runtime/package.json b/packages/jest-runtime/package.json index 04d8286a5af5..9f589a42916c 100644 --- a/packages/jest-runtime/package.json +++ b/packages/jest-runtime/package.json @@ -30,7 +30,6 @@ "chalk": "^4.0.0", "cjs-module-lexer": "^1.0.0", "collect-v8-coverage": "^1.0.0", - "glob": "^10.3.10", "graceful-fs": "^4.2.9", "jest-haste-map": "workspace:*", "jest-message-util": "workspace:*", @@ -40,7 +39,8 @@ "jest-snapshot": "workspace:*", "jest-util": "workspace:*", "slash": "^3.0.0", - "strip-bom": "^4.0.0" + "strip-bom": "^4.0.0", + "tinyglobby": "^0.2.5" }, "devDependencies": { "@jest/test-utils": "workspace:*", diff --git a/packages/jest-runtime/src/helpers.ts b/packages/jest-runtime/src/helpers.ts index 552a03590356..a95bc43f50ee 100644 --- a/packages/jest-runtime/src/helpers.ts +++ b/packages/jest-runtime/src/helpers.ts @@ -6,8 +6,8 @@ */ import * as path from 'path'; -import {glob} from 'glob'; import slash = require('slash'); +import {globSync} from 'tinyglobby'; import type {Config} from '@jest/types'; const OUTSIDE_JEST_VM_PROTOCOL = 'jest-main:'; @@ -41,8 +41,7 @@ export const findSiblingsWithFileExtension = ( try { const slashedDirname = slash(dirname); - const matches = glob - .sync(`${pathToModule}.*`, {windowsPathsNoEscape: true}) + const matches = globSync([`${pathToModule}.*`.replaceAll('\\', '/')]) .map(match => slash(match)) .map(match => { const relativePath = path.posix.relative(slashedDirname, match); diff --git a/packages/jest-runtime/tsconfig.json b/packages/jest-runtime/tsconfig.json index e62786852942..f24d11721a98 100644 --- a/packages/jest-runtime/tsconfig.json +++ b/packages/jest-runtime/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { // needed for WebAssembly, see https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826 - "lib": ["dom"], + "lib": ["dom", "es2021"], "rootDir": "src", "outDir": "build" }, diff --git a/yarn.lock b/yarn.lock index 929dc0086e05..9ccb3126b3e3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13612,7 +13612,6 @@ __metadata: chalk: ^4.0.0 cjs-module-lexer: ^1.0.0 collect-v8-coverage: ^1.0.0 - glob: ^10.3.10 graceful-fs: ^4.2.9 jest-environment-node: "workspace:*" jest-haste-map: "workspace:*" @@ -13624,6 +13623,7 @@ __metadata: jest-util: "workspace:*" slash: ^3.0.0 strip-bom: ^4.0.0 + tinyglobby: ^0.2.5 languageName: unknown linkType: soft