-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(e2e): parallelize testworkspace installation (#1396)
- Loading branch information
Showing
25 changed files
with
221 additions
and
517 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file renamed
BIN
+64.2 KB
...-cli-npm-7.25.1-cbec39f0a7-667f6155a0.zip → ...-cli-npm-7.27.0-54d9c241d2-5dcff265e6.zip
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+54.6 KB
...vice-npm-7.25.1-ed6bfc45b0-32c51e663f.zip → ...vice-npm-7.27.0-d7fad4e2c5-7256c17aa5.zip
Binary file not shown.
Binary file renamed
BIN
+17.8 KB
...nner-npm-7.25.1-6972ef85e7-a2f273ff42.zip → ...nner-npm-7.27.0-650a25bf92-5a06d7e98d.zip
Binary file not shown.
Binary file removed
BIN
-13.7 KB
.yarn/cache/@wdio-mocha-framework-npm-7.25.1-4aa06cf553-4d482a4da9.zip
Binary file not shown.
Binary file added
BIN
+13.8 KB
.yarn/cache/@wdio-mocha-framework-npm-7.26.0-5d16151eaa-56feb30c63.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+23.1 KB
...rter-npm-7.25.1-8529248a2f-41f4dbb5a7.zip → ...rter-npm-7.26.0-4caeeb8409-021e11e9ad.zip
Binary file not shown.
Binary file renamed
BIN
+14.3 KB
...nner-npm-7.25.1-b0fb78ca50-d72d47f7a4.zip → ...nner-npm-7.27.0-13864fb0fe-0f789ede9d.zip
Binary file not shown.
Binary file renamed
BIN
+14.2 KB
...rter-npm-7.25.1-2a0646b0ad-b7305b64d6.zip → ...rter-npm-7.26.0-2ee7ef17ca-7d19a7ab89.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file renamed
BIN
+146 KB
...ools-npm-7.25.1-0e4d2b21d1-551c87b5c7.zip → ...ools-npm-7.27.0-90903e2626-3a09b8bfaa.zip
Binary file not shown.
Binary file removed
BIN
-362 KB
.yarn/cache/devtools-protocol-npm-0.0.1049481-9bb45728b3-787af6b3cc.zip
Binary file not shown.
Binary file added
BIN
+368 KB
.yarn/cache/devtools-protocol-npm-0.0.1075032-686d7a4546-6a983333be.zip
Binary file not shown.
Binary file renamed
BIN
+13.2 MB
...rvice-npm-4.2.0-a7b8d4ba36-9bdacbcd37.zip → ...rvice-npm-4.2.1-10f92c42c3-76a38a03f7.zip
Binary file not shown.
Binary file renamed
BIN
+28.8 KB
...iver-npm-7.25.1-74cd8c1403-d6feaf1323.zip → ...iver-npm-7.27.0-34a8a16345-6a908a6894.zip
Binary file not shown.
Binary file renamed
BIN
+283 KB
...erio-npm-7.25.1-5191d1f098-2348d1f13a.zip → ...erio-npm-7.27.0-d163b6f2f4-a1c247afeb.zip
Binary file not shown.
68 changes: 68 additions & 0 deletions
68
apps/vscode-e2e/services/testworkspace-installation.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import { exec } from 'child_process'; | ||
import { | ||
existsSync, | ||
rmSync, | ||
readdirSync, | ||
mkdirSync, | ||
lstatSync, | ||
copyFileSync, | ||
} from 'fs'; | ||
import { basename, dirname, join } from 'path'; | ||
import { promisify } from 'util'; | ||
import { SevereServiceError } from 'webdriverio'; | ||
import { getTestWorkspacePath } from '../specs/utils'; | ||
|
||
export class TestworkspaceInstallationService { | ||
async onPrepare() { | ||
const testWorkspacePath = getTestWorkspacePath(); | ||
if (existsSync(testWorkspacePath)) { | ||
rmSync(testWorkspacePath, { recursive: true, force: true }); | ||
} | ||
|
||
// copy testworkspaces and remove after running the tests | ||
copyFolderRecursiveSync(`./testworkspaces`, dirname(testWorkspacePath)); | ||
const testWorkspaces = readdirSync(testWorkspacePath, { | ||
withFileTypes: true, | ||
}).filter((dirent) => dirent.isDirectory()); | ||
|
||
process.on('exit', () => { | ||
rmSync(testWorkspacePath, { recursive: true, force: true }); | ||
}); | ||
|
||
console.log('installing testworkspace dependencies....'); | ||
console.time('done in'); | ||
await Promise.all( | ||
testWorkspaces.map(async (tws) => { | ||
await promisify(exec)('npm ci', { | ||
cwd: join(testWorkspacePath, tws.name), | ||
}).catch((e) => { | ||
throw new SevereServiceError(); | ||
// `Failed to install dependencies for ${tws.name}: \n ${e}` | ||
}); | ||
}) | ||
); | ||
|
||
console.timeLog('done in'); | ||
} | ||
} | ||
|
||
function copyFolderRecursiveSync(source: string, target: string) { | ||
// Check if folder needs to be created or integrated | ||
const targetFolder = join(target, basename(source)); | ||
if (!existsSync(targetFolder)) { | ||
mkdirSync(targetFolder); | ||
} | ||
|
||
// Copy everything but ignore node_modules | ||
if (lstatSync(source).isDirectory() && !source.includes('node_modules')) { | ||
const files = readdirSync(source); | ||
files.forEach(function (file) { | ||
const curSource = join(source, file); | ||
if (lstatSync(curSource).isDirectory()) { | ||
copyFolderRecursiveSync(curSource, targetFolder); | ||
} else { | ||
copyFileSync(curSource, join(targetFolder, file)); | ||
} | ||
}); | ||
} | ||
} |
Oops, something went wrong.