From df7a9299a5841fdd739858e82ed37687a823297d Mon Sep 17 00:00:00 2001 From: Hong Xu Date: Wed, 29 Jan 2025 16:44:48 -0800 Subject: [PATCH] Update glob to latest --- package-lock.json | 86 ++++++++------------------------ package.json | 2 +- src/test/suite/index.ts | 36 ++++++------- src/test/untitled-suite/index.ts | 37 ++++++-------- 4 files changed, 54 insertions(+), 107 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1c6104a..a5dffc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "eslint-config-prettier": "^10.0.1", "eslint-config-xo": "^0.45.0", "eslint-plugin-prettier": "^5.2.3", - "glob": "^8.0.0", + "glob": "^11.0.1", "husky": "^4.0.0", "lint-staged": "^15.4.3", "mocha": "^11.1.0", @@ -2297,21 +2297,24 @@ "license": "MIT" }, "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.1.tgz", + "integrity": "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==", "dev": true, "license": "ISC", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" + "foreground-child": "^3.1.0", + "jackspeak": "^4.0.1", + "minimatch": "^10.0.0", + "minipass": "^7.1.2", + "package-json-from-dist": "^1.0.0", + "path-scurry": "^2.0.0" + }, + "bin": { + "glob": "dist/esm/bin.mjs" }, "engines": { - "node": ">=12" + "node": "20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" @@ -2341,16 +2344,19 @@ } }, "node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^2.0.1" }, "engines": { - "node": ">=10" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/globals": { @@ -4540,56 +4546,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.1.tgz", - "integrity": "sha512-zrQDm8XPnYEKawJScsnM0QzobJxlT/kHOOlRTio8IH/GrmxRE5fjllkzdaHclIuNjUQTJYH2xHNIGfdpJkDJUw==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", diff --git a/package.json b/package.json index bbe988f..b323cb9 100644 --- a/package.json +++ b/package.json @@ -115,7 +115,7 @@ "eslint-config-prettier": "^10.0.1", "eslint-config-xo": "^0.45.0", "eslint-plugin-prettier": "^5.2.3", - "glob": "^8.0.0", + "glob": "^11.0.1", "husky": "^4.0.0", "lint-staged": "^15.4.3", "mocha": "^11.1.0", diff --git a/src/test/suite/index.ts b/src/test/suite/index.ts index 99b6f40..ac12f9c 100644 --- a/src/test/suite/index.ts +++ b/src/test/suite/index.ts @@ -1,4 +1,4 @@ -import * as glob from 'glob' +import { globSync } from 'glob' import * as Mocha from 'mocha' import * as path from 'path' @@ -11,26 +11,22 @@ export function run(): Promise { }) return new Promise((c, e) => { - glob('./**/*.test.js', { cwd: __dirname }, (err, files) => { - if (err) { - return e(err) - } + const files = globSync('./**/*.test.js', { cwd: __dirname }) - // Add files to the test suite - files.forEach(f => mocha.addFile(path.resolve(__dirname, f))) + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(__dirname, f))) - try { - // Run the mocha test - mocha.run(failures => { - if (failures > 0) { - e(new Error(`${failures} tests failed.`)) - } else { - c() - } - }) - } catch (err) { - e(err) - } - }) + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)) + } else { + c() + } + }) + } catch (err) { + e(err) + } }) } diff --git a/src/test/untitled-suite/index.ts b/src/test/untitled-suite/index.ts index 99b6f40..448a016 100644 --- a/src/test/untitled-suite/index.ts +++ b/src/test/untitled-suite/index.ts @@ -1,4 +1,4 @@ -import * as glob from 'glob' +import { globSync } from 'glob' import * as Mocha from 'mocha' import * as path from 'path' @@ -11,26 +11,21 @@ export function run(): Promise { }) return new Promise((c, e) => { - glob('./**/*.test.js', { cwd: __dirname }, (err, files) => { - if (err) { - return e(err) - } + const files = globSync('./**/*.test.js', { cwd: __dirname }) + // Add files to the test suite + files.forEach(f => mocha.addFile(path.resolve(__dirname, f))) - // Add files to the test suite - files.forEach(f => mocha.addFile(path.resolve(__dirname, f))) - - try { - // Run the mocha test - mocha.run(failures => { - if (failures > 0) { - e(new Error(`${failures} tests failed.`)) - } else { - c() - } - }) - } catch (err) { - e(err) - } - }) + try { + // Run the mocha test + mocha.run(failures => { + if (failures > 0) { + e(new Error(`${failures} tests failed.`)) + } else { + c() + } + }) + } catch (err) { + e(err) + } }) }