From 33a597479974f0679a61e1dcb373e35e6d422bf6 Mon Sep 17 00:00:00 2001 From: Victor Rubezhny Date: Fri, 8 Sep 2023 20:49:56 +0200 Subject: [PATCH] Fix build errors after DB update glob from 7.2.3 to 10.3.4 Signed-off-by: Victor Rubezhny --- test/integration/index.ts | 11 +++++------ test/unit/index.ts | 11 +++++------ test/vsix-test/index.ts | 13 ++++++------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/test/integration/index.ts b/test/integration/index.ts index 53253c3af..3a232d5c8 100644 --- a/test/integration/index.ts +++ b/test/integration/index.ts @@ -37,13 +37,12 @@ function loadCoverageRunner(testsRoot: string): CoverageRunner | undefined { async function collectTests(testsRoot: string): Promise { const files = await new Promise((resolve, reject) => { - glob('**.test.js', { cwd: testsRoot }, (error, files): void => { - if (error) { - reject(error); - } else { + glob('**.test.js', { cwd: testsRoot }) + .then(files => { resolve(files); - } - }); + }).catch(error => { + reject(error); + }); }); return files; } diff --git a/test/unit/index.ts b/test/unit/index.ts index 9d1d888b1..d016174fc 100644 --- a/test/unit/index.ts +++ b/test/unit/index.ts @@ -37,13 +37,12 @@ function loadCoverageRunner(testsRoot: string): CoverageRunner | undefined { function createTestFinder(testsRoot: string) { return (pattern: string): Promise => { return new Promise((resolve, reject) => { - glob(pattern, { cwd: testsRoot }, (error, files): void => { - if (error) { - reject(error); - } else { + glob(pattern, { cwd: testsRoot }) + .then(files => { resolve(files); - } - }); + }).catch(error => { + reject(error); + }); }); } } diff --git a/test/vsix-test/index.ts b/test/vsix-test/index.ts index f8e25f6fc..bea9087d2 100644 --- a/test/vsix-test/index.ts +++ b/test/vsix-test/index.ts @@ -19,12 +19,10 @@ const config: Mocha.MochaOptions = { const mocha = new Mocha(config); export function run(): Promise { - return new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { const testsRoot = paths.resolve(__dirname); - glob('**/**.test.js', { cwd: testsRoot }, (error, files): void => { - if (error) { - reject(error); - } else { + glob('**/**.test.js', { cwd: testsRoot }) + .then(files => { files.forEach((f): Mocha => mocha.addFile(paths.join(testsRoot, f))); mocha.run(failures => { if (failures > 0) { @@ -33,7 +31,8 @@ export function run(): Promise { resolve(); } }); - } - }); + }).catch(error => { + reject(error); + }); }); }