Skip to content

Commit 0d6af31

Browse files
committed
chore: more glob adjustments
1 parent 5bb22e3 commit 0d6af31

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

packages/compass-e2e-tests/helpers/gunzip.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { glob as globAsync } from 'glob';
33
import { createReadStream, createWriteStream } from 'fs';
44
import { pipeline } from 'stream/promises';
55
import { createGunzip } from 'zlib';
6+
import path from 'path';
67

78
const debug = Debug('compass-e2e-tests:gunzip');
89

@@ -20,14 +21,19 @@ async function gunzip(input: string, output: string, signal: AbortSignal) {
2021
}
2122
}
2223

23-
async function run(glob: string, signal: AbortSignal) {
24-
const filenames = await globAsync(glob);
24+
async function run(glob: string, cwd: string, signal: AbortSignal) {
25+
const filenames = (await globAsync(glob, { cwd })).map((filepath) => {
26+
return path.join(cwd, filepath);
27+
});
28+
if (filenames.length === 0) {
29+
throw new Error(`Failed to unpack ${glob} at ${cwd}: no files found`);
30+
}
31+
debug('Unpacking following files:', filenames);
2532
for (const input of filenames) {
2633
if (signal.aborted) {
2734
return;
2835
}
2936
const output = input.replace(/\.gz$/, '');
30-
debug(input, '=>', output);
3137
await gunzip(input, output, signal);
3238
}
3339
}

packages/compass-e2e-tests/helpers/test-runner-global-fixtures.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
DEFAULT_CONNECTIONS,
55
DEFAULT_CONNECTIONS_SERVER_INFO,
66
DISABLE_START_STOP,
7+
E2E_WORKSPACE_PATH,
78
LOG_PATH,
89
SKIP_COMPASS_DESKTOP_COMPILE,
910
SKIP_NATIVE_MODULE_REBUILD,
@@ -67,7 +68,8 @@ export async function mochaGlobalSetup(this: Mocha.Runner) {
6768
await gunzip(
6869
// Not using absolute paths because Windows fails to resolve glob
6970
// collectly in this case
70-
'../fixtures/*.gz',
71+
'fixtures/*.gz',
72+
E2E_WORKSPACE_PATH,
7173
globalFixturesAbortController.signal
7274
);
7375

0 commit comments

Comments
 (0)