Skip to content

Commit

Permalink
perf(e2e): parallelize testworkspace installation
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxKless committed Oct 27, 2022
1 parent c7adefd commit dc28743
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions apps/vscode-e2e/wdio.conf.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Options } from '@wdio/types';
import { execSync } from 'child_process';
import { exec } from 'child_process';
import {
copyFileSync,
existsSync,
Expand All @@ -9,6 +9,7 @@ import {
rmSync,
} from 'fs';
import { basename, dirname, join } from 'path';
import { promisify } from 'util';
import { getTestWorkspacePath } from './specs/utils';

const debug = process.env.DEBUG;
Expand Down Expand Up @@ -208,19 +209,19 @@ export const config: Options.Testrunner = {

console.log('installing testworkspace dependencies....');
console.time('done in');
testWorkspaces.forEach((tws) => {
try {
execSync('npm ci', {
await Promise.all(
testWorkspaces.map(async (tws) => {
await promisify(exec)('npm ci', {
cwd: join(testWorkspacePath, tws.name),
stdio: 'ignore',
}).catch((e) => {
console.error(`Failed to install dependencies for ${tws.name}`);
if (debug) {
console.error(e);
}
});
} catch (e) {
console.error(`Failed to install dependencies for ${tws.name}`);
if (debug) {
console.error(e);
}
}
});
})
);

console.timeLog('done in');

process.on('exit', () => {
Expand Down

0 comments on commit dc28743

Please sign in to comment.