Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace mock-fs with memfs that works in node20 (backport #355) #640

Merged
merged 2 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions test/jsii/assemblies.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { promises as fs } from 'node:fs';
import * as path from 'node:path';
import * as spec from '@jsii/spec';
import * as mockfs from 'mock-fs';
import { Volume } from 'memfs';

import { fakeAssembly } from './fake-assembly';
import { allTypeScriptSnippets } from '../../lib/jsii/assemblies';
import { SnippetParameters } from '../../lib/snippet';
import { TestJsiiModule, DUMMY_JSII_CONFIG } from '../testutil';
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { patchFs } = require('fs-monkey');

jest.setTimeout(30_000);

Expand Down Expand Up @@ -201,9 +203,11 @@ test('Fixture allows use of import statements', async () => {
});

test('Backwards compatibility with literate integ tests', async () => {
mockfs({
'/package/test/integ.example.lit.ts': '# Some literate source file',
});
const unpatch = patchFs(
Volume.fromJSON({
'/package/test/integ.example.lit.ts': '# Some literate source file',
}),
);

try {
const snippets = Array.from(
Expand Down Expand Up @@ -231,7 +235,7 @@ test('Backwards compatibility with literate integ tests', async () => {
path.normalize('/package/test'),
);
} finally {
mockfs.restore();
unpatch();
}
});

Expand Down
6 changes: 3 additions & 3 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading