Skip to content

Commit

Permalink
test: add bin test and fix other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-alford committed Sep 9, 2024
1 parent 7c01da1 commit 6f2dd08
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions tests/ExportsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ function assertRight(e: E.Either<unknown, unknown>): asserts e is E.Right<unknow

describe('ExportsService', () => {
test.each([
tuple(
'`bin` field resolution',
ConfigServiceLive({
buildMode: { type: 'Single', entrypoint: 'foo.ts' },
bin: {
foo: './foo.ts',
bar: './bar.ts',
},
}),
ExportsService.ExportsServiceLive({
files: ['foo.ts', 'bar.ts'],
type: 'module',
resolvedIndex: 'foo.ts',
}),
tuple(
{
'.': {
import: { types: './foo.d.ts', default: './foo.js' },
require: { types: './foo.d.cts', default: './foo.cjs' },
},
'./package.json': './package.json',
},
'./foo.cjs',
'./foo.js',
'./foo.d.cts',
{
foo: './foo.js',
bar: './bar.js',
},
),
),
tuple(
'Dual "type: module" Single Exports',
ConfigServiceLive({
Expand All @@ -32,6 +63,7 @@ describe('ExportsService', () => {
'./foo.cjs',
'./foo.js',
'./foo.d.cts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -67,6 +99,7 @@ describe('ExportsService', () => {
'./src/foo.cjs',
'./src/foo.js',
'./src/foo.d.cts',
undefined,
),
),
tuple(
Expand All @@ -90,6 +123,7 @@ describe('ExportsService', () => {
'./foo.js',
'./foo.mjs',
'./foo.d.ts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -125,6 +159,7 @@ describe('ExportsService', () => {
'./src/foo.js',
'./src/foo.mjs',
'./src/foo.d.ts',
undefined,
),
),
tuple(
Expand All @@ -148,6 +183,7 @@ describe('ExportsService', () => {
'./foo.cjs',
undefined,
'./foo.d.cts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -181,6 +217,7 @@ describe('ExportsService', () => {
'./src/foo.cjs',
undefined,
'./src/foo.d.cts',
undefined,
),
),
tuple(
Expand All @@ -204,6 +241,7 @@ describe('ExportsService', () => {
'./foo.js',
undefined,
'./foo.d.ts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -237,6 +275,7 @@ describe('ExportsService', () => {
'./src/foo.js',
undefined,
'./src/foo.d.ts',
undefined,
),
),
tuple(
Expand All @@ -260,6 +299,7 @@ describe('ExportsService', () => {
undefined,
'./foo.mjs',
'./foo.d.mts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -293,6 +333,7 @@ describe('ExportsService', () => {
undefined,
'./src/foo.mjs',
'./src/foo.d.mts',
undefined,
),
),
tuple(
Expand All @@ -316,6 +357,7 @@ describe('ExportsService', () => {
undefined,
'./foo.js',
'./foo.d.ts',
undefined,
),
),
tuple(
Expand Down Expand Up @@ -349,6 +391,7 @@ describe('ExportsService', () => {
undefined,
'./src/foo.js',
'./src/foo.d.ts',
undefined,
),
),
])('%s', async (_, configService, service, expected) => {
Expand Down

0 comments on commit 6f2dd08

Please sign in to comment.