Skip to content

Commit 2e4925b

Browse files
jbedardalan-agius4
authored andcommitted
test: revert local test project file changes on test completion
1 parent 96d39f8 commit 2e4925b

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

tests/legacy-cli/e2e/tests/misc/supported-angular.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ export default async function () {
2424

2525
// Major should succeed, but we don't need to test it here since it's tested everywhere else.
2626
// Major+1 and -1 should fail architect commands, but allow other commands.
27-
await fakeCoreVersion(cliMajor + 1);
28-
await expectToFail(() => ng('build'), 'Should fail Major+1');
29-
await ng('version');
30-
await fakeCoreVersion(cliMajor - 1);
31-
await ng('version');
32-
33-
// Restore the original core package.json.
34-
await writeFile(angularCorePkgPath, originalAngularCorePkgJson);
27+
try {
28+
await fakeCoreVersion(cliMajor + 1);
29+
await expectToFail(() => ng('build'), 'Should fail Major+1');
30+
await ng('version');
31+
await fakeCoreVersion(cliMajor - 1);
32+
await ng('version');
33+
} finally {
34+
// Restore the original core package.json.
35+
await writeFile(angularCorePkgPath, originalAngularCorePkgJson);
36+
}
3537
}

tests/legacy-cli/e2e_runner.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,15 @@ async function runInitializer(absoluteName: string) {
242242
async function runTest(absoluteName: string) {
243243
process.chdir(join(getGlobalVariable('projects-root'), 'test-project'));
244244

245-
await launchTestProcess(absoluteName);
246-
247-
logStack.push(new logging.NullLogger());
248245
try {
249-
await gitClean();
246+
await launchTestProcess(absoluteName);
250247
} finally {
251-
logStack.pop();
248+
logStack.push(new logging.NullLogger());
249+
try {
250+
await gitClean();
251+
} finally {
252+
logStack.pop();
253+
}
252254
}
253255
}
254256

0 commit comments

Comments
 (0)