Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Jan 7, 2025
1 parent db837d0 commit 831cd6e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions tests/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,19 +259,19 @@ export const fixtureDynamicImports: FileTree = {
};

// https://github.com/privatenumber/pkgroll/issues/104
export const fixtureDynamicImportsError: FileTree = {
export const fixtureDynamicImportUnresolvable: FileTree = {
'package.json': createPackageJson({
main: './dist/dynamic-imports.js',
}),
src: {
'dynamic-imports.js': outdent`
function importModule(path) {
// who knows what will be imported here?
return import(path);
// who knows what will be imported here?
return import(path);
}
importModule('./should-fail.js');
`,
'should-fail.js': 'console.log(123)',
importModule('./too-dynamic.js');
`,
'too-dynamic.js': 'console.log(123)',
},
};
6 changes: 3 additions & 3 deletions tests/specs/builds/output-commonjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFixture } from 'fs-fixture';
import { pkgroll } from '../../utils.js';
import {
packageFixture, createPackageJson, createTsconfigJson, fixtureDynamicImports,
fixtureDynamicImportsError,
fixtureDynamicImportUnresolvable,
} from '../../fixtures.js';

export default testSuite(({ describe }, nodePath: string) => {
Expand Down Expand Up @@ -207,9 +207,9 @@ export default testSuite(({ describe }, nodePath: string) => {
});

// https://github.com/privatenumber/pkgroll/issues/104
test('dynamic imports warning', async () => {
test('unresolvable dynamic import should not fail', async () => {
await using fixture = await createFixture({
...fixtureDynamicImportsError,
...fixtureDynamicImportUnresolvable,
'package.json': createPackageJson({
exports: './dist/dynamic-imports.cjs',
}),
Expand Down
6 changes: 3 additions & 3 deletions tests/specs/builds/output-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { createFixture } from 'fs-fixture';
import { pkgroll } from '../../utils.js';
import {
packageFixture, createPackageJson, createTsconfigJson, fixtureDynamicImports,
fixtureDynamicImportsError,
fixtureDynamicImportUnresolvable,
} from '../../fixtures.js';

export default testSuite(({ describe }, nodePath: string) => {
Expand Down Expand Up @@ -275,9 +275,9 @@ export default testSuite(({ describe }, nodePath: string) => {
});

// https://github.com/privatenumber/pkgroll/issues/104
test('dynamic imports warning', async () => {
test('unresolvable dynamic import should not fail', async () => {
await using fixture = await createFixture({
...fixtureDynamicImportsError,
...fixtureDynamicImportUnresolvable,
'package.json': createPackageJson({
exports: './dist/dynamic-imports.mjs',
}),
Expand Down

0 comments on commit 831cd6e

Please sign in to comment.