diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2023-03-30 14:34:48 +0200 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2023-04-05 14:58:54 +0200 |
| commit | 7898a3a6cfeba4cc65b6cddb72f38bcd83047fca (patch) | |
| tree | 0f01f687ca230de6110917ffdad975f0b7e74546 | |
| parent | 63f8589b55c571124fda0c55d3deb6bac6c3fc79 (diff) | |
| download | mullvadvpn-7898a3a6cfeba4cc65b6cddb72f38bcd83047fca.tar.xz mullvadvpn-7898a3a6cfeba4cc65b6cddb72f38bcd83047fca.zip | |
Move paths into functions to prevent using them in wrong situations
| -rw-r--r-- | gui/standalone-tests.ts | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/gui/standalone-tests.ts b/gui/standalone-tests.ts index 444341a6c1..bbb7a8c4b8 100644 --- a/gui/standalone-tests.ts +++ b/gui/standalone-tests.ts @@ -8,17 +8,13 @@ import path from 'path'; // assets and performs the tests. More info in /gui/README.md. const tmpDir = path.join(os.tmpdir(), 'mullvad-standalone-tests'); -const rootDir = path.join(__dirname, '..'); -const nodeModulesDir = path.join(rootDir, 'node_modules'); -const srcDir = path.join(rootDir, 'build', 'src'); -const testDir = path.join(rootDir, 'build', 'test'); - -const nodeBin = process.argv[0]; -const playwrightBin = path.join(tmpDir, 'node_modules', '@playwright', 'test', 'cli.js'); function main() { extract(); + const nodeBin = process.argv[0]; + const playwrightBin = path.join(tmpDir, 'node_modules', '@playwright', 'test', 'cli.js'); + // Tests need to be run sequentially since they interact with the same daemon instance. // Arguments are forwarded to playwright to make it possible to run specific tests. const args = [playwrightBin, 'test', '--workers', '1', ...process.argv.slice(2)]; @@ -29,6 +25,11 @@ function main() { } function extract() { + const rootDir = path.join(__dirname, '..'); + const nodeModulesDir = path.join(rootDir, 'node_modules'); + const srcDir = path.join(rootDir, 'build', 'src'); + const testDir = path.join(rootDir, 'build', 'test'); + // Remove old directory if already existing and create new clean one removeTmpDir(); fs.mkdirSync(tmpDir); |
