Skip to content

Commit

Permalink
Simplify tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kachkaev committed Oct 27, 2022
1 parent 612d480 commit dcff11e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 36 deletions.
8 changes: 8 additions & 0 deletions e2e/__tests__/__snapshots__/nativeEsm.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ Time: <<REPLACED>>
Ran all test suites matching /native-esm-deep-cjs-reexport.test.js/i."
`;
exports[`runs WASM test with native ESM 1`] = `
"Test Suites: 1 passed, 1 total
Tests: 4 passed, 4 total
Snapshots: 0 total
Time: <<REPLACED>>
Ran all test suites matching /native-esm-wasm.test.js/i."
`;
exports[`runs test with native ESM 1`] = `
"Test Suites: 1 passed, 1 total
Tests: 33 passed, 33 total
Expand Down
12 changes: 12 additions & 0 deletions e2e/__tests__/nativeEsm.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,15 @@ onNodeVersions('>=16.9.0', () => {
expect(exitCode).toBe(0);
});
});

test('runs WASM test with native ESM', () => {
const {exitCode, stderr, stdout} = runJest(DIR, ['native-esm-wasm.test.js'], {
nodeOptions: '--experimental-vm-modules --no-warnings',
});

const {summary} = extractSummary(stderr);

expect(summary).toMatchSnapshot();
expect(stdout).toBe('');
expect(exitCode).toBe(0);
});
34 changes: 0 additions & 34 deletions e2e/__tests__/nativeEsmWasm.test.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// eslint-disable-next-line no-restricted-imports
import {readFileSync} from 'fs';
// The file was generated by wasm-pack
import {getAnswer} from '../answer.wasm';
import {getAnswer} from '../42.wasm';

const wasmFileBuffer = readFileSync('answer.wasm');
const wasmFileBuffer = readFileSync('42.wasm');

test('supports native wasm imports', () => {
expect(getAnswer()).toBe(42);
Expand Down

0 comments on commit dcff11e

Please sign in to comment.