Skip to content

Commit

Permalink
test: add e2e for single-root-dual
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-alford committed Sep 5, 2024
1 parent 256e0c1 commit a9eca47
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ExportsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ function relativize(path: string): string {
}

// Paths for emitted build files
// NOTE: the paths here are lifted to the root level (dist)
// NOTE: the paths here are ./dist if there are no root-entrypoints,
// and ./dist/src if there are.
function tsToJs(file: string): string {
return relativize(file.replace(/\.tsx?$/, '.js'))
}
Expand Down
7 changes: 7 additions & 0 deletions tests/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ describe('test projects', () => {
// Used to test multi-entrypoint root based dual libs
// ------------------------------------------------
'multi-root-dual',
//
// NOTE: multi-entrypoint src based libs will not pass node-10 tests
//
// ------------------------------------------------
// Used to test single-entrypoint src based dual libs
// ------------------------------------------------
'single-src-dual',
// ------------------------------------------------
// Used to test single-entrypoint root based dual libs
// ------------------------------------------------
'single-root-dual',
]),
),
)(
Expand Down
1 change: 1 addition & 0 deletions tests/test-projects/single-root-dual/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
11 changes: 11 additions & 0 deletions tests/test-projects/single-root-dual/foo.foo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { bar } from './src/foo.bar.js'

/**
* What is it? Who knows!
*
* @remarks
* I have nothing to say
*/
export const Foo = bar.baz === 'baz' ? 'bar' : 'foo'

export type Bar = typeof bar
7 changes: 7 additions & 0 deletions tests/test-projects/single-root-dual/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "single-root-dual",
"version": "0.0.1",
"devDependencies": {
"@fp-tx/build-tools": "file:../../../dist"
}
}
1 change: 1 addition & 0 deletions tests/test-projects/single-root-dual/src/baz.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export type Baz = { baz: 'baz' }
6 changes: 6 additions & 0 deletions tests/test-projects/single-root-dual/src/foo.bar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type Baz } from './baz.js'

/** @public */
export const bar: Baz = {
baz: 'baz',
}
15 changes: 15 additions & 0 deletions tests/test-projects/single-root-dual/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "NodeNext",
"target": "ESNext",
"moduleResolution": "NodeNext",
"noEmit": true,
"strict": true,
"skipLibCheck": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"types": []
},
"include": ["./src/*.ts", "./*.ts"],
"exclude": []
}
19 changes: 19 additions & 0 deletions tests/test-projects/single-root-dual/tsup.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { makeConfig } = require('@fp-tx/build-tools')

module.exports = makeConfig(
{
basePath: '.',
buildType: 'dual',
buildMode: {
type: 'Single',
entrypoint: './foo.foo.ts',
},
srcDir: './src',
outDir: './dist',
copyFiles: [],
iife: true,
},
{
clean: true,
},
)

0 comments on commit a9eca47

Please sign in to comment.