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
This commit is contained in:
parent
f69e4e6f77
commit
97ab52c618
|
@ -9,6 +9,7 @@
|
||||||
import * as ts from 'typescript';
|
import * as ts from 'typescript';
|
||||||
|
|
||||||
import {absoluteFrom, setFileSystem} from '../../src/helpers';
|
import {absoluteFrom, setFileSystem} from '../../src/helpers';
|
||||||
|
import {InvalidFileSystem} from '../../src/invalid_file_system';
|
||||||
import {AbsoluteFsPath} from '../../src/types';
|
import {AbsoluteFsPath} from '../../src/types';
|
||||||
|
|
||||||
import {MockFileSystem} from './mock_file_system';
|
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) {
|
function runInFileSystem(os: string, callback: (os: string) => void, error: boolean) {
|
||||||
describe(`<<FileSystem: ${os}>>`, () => {
|
describe(`<<FileSystem: ${os}>>`, () => {
|
||||||
beforeEach(() => initMockFileSystem(os));
|
beforeEach(() => initMockFileSystem(os));
|
||||||
|
afterEach(() => setFileSystem(new InvalidFileSystem()));
|
||||||
callback(os);
|
callback(os);
|
||||||
if (error) {
|
if (error) {
|
||||||
afterAll(() => { throw new Error(`runInFileSystem limited to ${os}, cannot pass`); });
|
afterAll(() => { throw new Error(`runInFileSystem limited to ${os}, cannot pass`); });
|
||||||
|
|
Loading…
Reference in New Issue