From bb5611abc762022de70098e9bd921ccc61427863 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 29 May 2022 11:00:19 +0000 Subject: [PATCH] fix(deps): update dependency glob to v8.0.3 (#3531) * fix(deps): update dependency glob to v8.0.3 * Fix unit test for node glob Co-authored-by: Renovate Bot Co-authored-by: Nico Jansen --- e2e/package-lock.json | 32 ----------------- package-lock.json | 20 +++++------ package.json | 2 +- packages/core/package.json | 2 +- .../integration/utils/file-utils.it.spec.ts | 36 +++++++++---------- 5 files changed, 28 insertions(+), 64 deletions(-) diff --git a/e2e/package-lock.json b/e2e/package-lock.json index 53ac3827b1..e0b0c98f33 100644 --- a/e2e/package-lock.json +++ b/e2e/package-lock.json @@ -5911,26 +5911,6 @@ "node": ">=10" } }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -5949,18 +5929,6 @@ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==", "dev": true }, - "node_modules/glob/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/global-modules": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", diff --git a/package-lock.json b/package-lock.json index d743ed380e..6436ce5f1a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,7 @@ "eslint-plugin-prettier": "4.0.0", "eslint-plugin-unicorn": "42.0.0", "execa": "6.1.0", - "glob": "8.0.1", + "glob": "8.0.3", "install-local": "3.0.1", "jasmine": "4.1.0", "jasmine-core": "4.1.1", @@ -5475,17 +5475,16 @@ } }, "node_modules/glob": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.1.tgz", - "integrity": "sha512-cF7FYZZ47YzmCu7dDy50xSRRfO3ErRfrXuLZcNIuyiJEco0XSrGtuilG19L5xp3NcwTx7Gn+X6Tv3fmsUPTbow==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "once": "^1.3.0" }, "engines": { "node": ">=12" @@ -15432,17 +15431,16 @@ } }, "glob": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.1.tgz", - "integrity": "sha512-cF7FYZZ47YzmCu7dDy50xSRRfO3ErRfrXuLZcNIuyiJEco0XSrGtuilG19L5xp3NcwTx7Gn+X6Tv3fmsUPTbow==", + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^5.0.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "once": "^1.3.0" } }, "glob-parent": { diff --git a/package.json b/package.json index 43387ef6c4..463d0b4791 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "eslint-plugin-prettier": "4.0.0", "eslint-plugin-unicorn": "42.0.0", "execa": "6.1.0", - "glob": "8.0.1", + "glob": "8.0.3", "install-local": "3.0.1", "jasmine": "4.1.0", "jasmine-core": "4.1.1", diff --git a/packages/core/package.json b/packages/core/package.json index 556ee2ac56..1c43c7344b 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -66,7 +66,7 @@ "execa": "~6.1.0", "file-url": "~4.0.0", "get-port": "~6.1.0", - "glob": "~7.2.0", + "glob": "~8.0.0", "inquirer": "~8.2.0", "lodash.flatmap": "~4.5.0", "lodash.groupby": "~4.6.0", diff --git a/packages/core/test/integration/utils/file-utils.it.spec.ts b/packages/core/test/integration/utils/file-utils.it.spec.ts index 1b9fd3afe0..9980cd902d 100644 --- a/packages/core/test/integration/utils/file-utils.it.spec.ts +++ b/packages/core/test/integration/utils/file-utils.it.spec.ts @@ -2,15 +2,18 @@ import os from 'os'; import path from 'path'; import { promises as fsPromises } from 'fs'; -import mkdirp from 'mkdirp'; +import { promisify } from 'util'; +import mkdirp from 'mkdirp'; import { expect } from 'chai'; -import { File } from '@stryker-mutator/util'; import nodeGlob from 'glob'; +import { File } from '@stryker-mutator/util'; import { assertions } from '@stryker-mutator/test-helpers'; import { fileUtils } from '../../../src/utils/file-utils.js'; +const glob = promisify(nodeGlob); + describe('fileUtils', () => { describe('moveDirectoryRecursiveSync', () => { const from = path.resolve(os.tmpdir(), 'moveDirectoryRecursiveSyncFrom'); @@ -68,23 +71,18 @@ describe('fileUtils', () => { }); async function readDirRecursive(dir: string): Promise { - return new Promise((res, rej) => { - nodeGlob(path.join(dir, '**/*'), { nodir: true }, (err, matches) => { - if (err) { - rej(err); - } - // eslint-disable-next-line @typescript-eslint/require-array-sort-compare - matches.sort(); - res( - Promise.all( - matches.map(async (fileName) => { - const content = await fsPromises.readFile(fileName); - return new File(path.normalize(fileName), content); - }) - ) - ); - }); - }); + const fileNames = await glob('**/*', { cwd: dir, nodir: true }); + const files = Promise.all( + // eslint-disable-next-line @typescript-eslint/require-array-sort-compare + fileNames + .sort() + .map((fileName) => path.resolve(dir, fileName)) + .map(async (fileName) => { + const content = await fsPromises.readFile(fileName); + return new File(path.normalize(fileName), content); + }) + ); + return files; } async function writeAll(...files: File[]): Promise {