|
1 | 1 | /* eslint-disable no-console */ |
2 | 2 | import { spawn } from 'child_process'; |
3 | | -import { resolve } from 'path'; |
4 | 3 | import * as dotenv from 'dotenv'; |
5 | 4 | import { sync as globSync } from 'glob'; |
| 5 | +import { resolve } from 'path'; |
6 | 6 |
|
7 | | -import { readFileSync } from 'fs'; |
8 | 7 | import { registrySetup } from './registrySetup'; |
9 | 8 |
|
10 | 9 | const DEFAULT_DSN = 'https://username@domain/123'; |
11 | 10 | const DEFAULT_SENTRY_ORG_SLUG = 'sentry-javascript-sdks'; |
12 | 11 | const DEFAULT_SENTRY_PROJECT = 'sentry-javascript-e2e-tests'; |
13 | 12 |
|
14 | | -interface PackageJson { |
15 | | - volta?: { |
16 | | - node?: string; |
17 | | - }; |
18 | | -} |
19 | | - |
20 | | -function getVoltaNodeVersion(packageJsonPath: string): string | undefined { |
21 | | - try { |
22 | | - const packageJson: PackageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); |
23 | | - return packageJson.volta?.node; |
24 | | - } catch { |
25 | | - return undefined; |
26 | | - } |
27 | | -} |
28 | | - |
29 | 13 | function asyncExec( |
30 | 14 | command: string, |
31 | 15 | options: { env: Record<string, string | undefined>; cwd: string; nodeVersion?: string }, |
32 | 16 | ): Promise<void> { |
33 | 17 | return new Promise((resolve, reject) => { |
34 | | - const finalCommand = options.nodeVersion ? `volta run --node ${options.nodeVersion} ${command}` : command; |
35 | | - const process = spawn(finalCommand, { ...options, shell: true }); |
| 18 | + const process = spawn(command, { ...options, shell: true }); |
36 | 19 |
|
37 | 20 | process.stdout.on('data', data => { |
38 | 21 | console.log(`${data}`); |
@@ -95,13 +78,12 @@ async function run(): Promise<void> { |
95 | 78 |
|
96 | 79 | for (const testAppPath of testAppPaths) { |
97 | 80 | const cwd = resolve('test-applications', testAppPath); |
98 | | - const nodeVersion = getVoltaNodeVersion(resolve(cwd, 'package.json')); |
99 | 81 |
|
100 | 82 | console.log(`Building ${testAppPath}...`); |
101 | | - await asyncExec('pnpm test:build', { env, cwd, nodeVersion }); |
| 83 | + await asyncExec('pnpm test:build', { env, cwd }); |
102 | 84 |
|
103 | 85 | console.log(`Testing ${testAppPath}...`); |
104 | | - await asyncExec('pnpm test:assert', { env, cwd, nodeVersion }); |
| 86 | + await asyncExec('pnpm test:assert', { env, cwd }); |
105 | 87 | } |
106 | 88 | } catch (error) { |
107 | 89 | console.error(error); |
|
0 commit comments