Skip to content

Commit b764ecb

Browse files
alan-agius4clydin
authored andcommitted
test: minor clean up of runSteps logic
Remove redundant vars and imports
1 parent b4767ae commit b764ecb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/legacy-cli/e2e_runner.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as path from 'path';
77
import { getGlobalVariable, setGlobalVariable } from './e2e/utils/env';
88
import { gitClean } from './e2e/utils/git';
99
import { createNpmRegistry } from './e2e/utils/registry';
10-
import { AddressInfo, createServer, Server } from 'net';
10+
import { AddressInfo, createServer } from 'net';
1111
import { launchTestProcess } from './e2e/utils/process';
1212
import { join } from 'path';
1313

@@ -123,8 +123,6 @@ setGlobalVariable('argv', argv);
123123
setGlobalVariable('ci', process.env['CI']?.toLowerCase() === 'true' || process.env['CI'] === '1');
124124
setGlobalVariable('package-manager', argv.yarn ? 'yarn' : 'npm');
125125

126-
let lastTestRun: string | null = null;
127-
128126
Promise.all([findFreePort(), findFreePort()])
129127
.then(async ([httpPort, httpsPort]) => {
130128
setGlobalVariable('package-registry', 'http://localhost:' + httpPort);
@@ -142,7 +140,6 @@ Promise.all([findFreePort(), findFreePort()])
142140
console.log(colors.green('Done.'));
143141
} catch (err) {
144142
console.log('\n');
145-
console.error(colors.red(`Test "${lastTestRun}" failed...`));
146143
console.error(colors.red(err.message));
147144
console.error(colors.red(err.stack));
148145

@@ -187,7 +184,11 @@ async function runSteps(
187184
// Run the test function with the current file on the logStack.
188185
logStack.push(lastLogger().createChild(absoluteName));
189186
try {
190-
await run((lastTestRun = absoluteName));
187+
await run(absoluteName);
188+
} catch (e) {
189+
console.log('\n');
190+
console.error(colors.red(`Step "${absoluteName}" failed...`));
191+
throw e;
191192
} finally {
192193
logStack.pop();
193194
}

0 commit comments

Comments
 (0)