From 97ab52c6183fa23b535e6988d7b55e0392128450 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Thu, 18 Jul 2019 21:05:31 +0100 Subject: [PATCH] test(ivy): ensure that `runInEachFileSystem` cleans up after itself (#31544) Previously the last file-system being tested was left as the current file-system. Now it is reset to an `InvalidFileSystem` to ensure future tests are not affected. PR Close #31544 --- .../src/ngtsc/file_system/testing/src/test_helper.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts b/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts index b2b550d381..f9ff163cc9 100644 --- a/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts +++ b/packages/compiler-cli/src/ngtsc/file_system/testing/src/test_helper.ts @@ -9,6 +9,7 @@ import * as ts from 'typescript'; import {absoluteFrom, setFileSystem} from '../../src/helpers'; +import {InvalidFileSystem} from '../../src/invalid_file_system'; import {AbsoluteFsPath} from '../../src/types'; import {MockFileSystem} from './mock_file_system'; @@ -43,6 +44,7 @@ function runInEachFileSystemFn(callback: (os: string) => void) { function runInFileSystem(os: string, callback: (os: string) => void, error: boolean) { describe(`<>`, () => { beforeEach(() => initMockFileSystem(os)); + afterEach(() => setFileSystem(new InvalidFileSystem())); callback(os); if (error) { afterAll(() => { throw new Error(`runInFileSystem limited to ${os}, cannot pass`); });