Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Sep 26, 2023
1 parent 3690258 commit 4f66d3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
5 changes: 4 additions & 1 deletion tests-esm/specs/javascript/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
describe('module dependency', ({ test }) => {
const output = '{"default":"default export","namedExport":"named export"}';

test('Import', async () => {
test('Import', async ({ onTestFail }) => {
const nodeProcess = await node.import('package-module');
onTestFail(() => {
console.log(nodeProcess);
});
expect(nodeProcess.stdout).toBe(output);
});
});
Expand Down
20 changes: 16 additions & 4 deletions tests-esm/specs/typescript/dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,41 @@ export default testSuite(async ({ describe }, node: NodeApis) => {
describe('TypeScript dependency', ({ test }) => {
const output = '{"default":"ts default export","namedExport":"ts named export"}';

test('Import', async () => {
test('Import', async ({ onTestFail }) => {
const nodeProcess = await node.import('package-module/ts.ts');
onTestFail(() => {
console.log(nodeProcess);
});
expect(nodeProcess.stdout).toBe(output);
});

test('Import extensionless', async () => {
test('Import extensionless', async ({ onTestFail }) => {
const nodeProcess = await node.import('package-module/ts');
onTestFail(() => {
console.log(nodeProcess);
});
expect(nodeProcess.stdout).toBe(output);
});

test('Import', async () => {
test('Import', async ({ onTestFail }) => {
const nodeProcess = await node.import('package-typescript-export');
onTestFail(() => {
console.log(nodeProcess);
});
expect(nodeProcess.stdout).toBe(output);
});
});

describe('Export map', ({ test }) => {
const output = '{"default":"default export","namedExport":"named export"}';

test('Import', async () => {
test('Import', async ({ onTestFail }) => {
const nodeProcess = await node.import('package-exports/index.js', {
typescript: true,
});
onTestFail(() => {
console.log(nodeProcess);
});
expect(nodeProcess.stdout).toBe(output);
});
});
Expand Down

0 comments on commit 4f66d3d

Please sign in to comment.