-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit introduces a new build test for the project. It also includes a snapshot for the expected output of the build process. The build.ts file has been deleted as part of this change. A new fixture file main.ts has been added to support the new test.
- Loading branch information
Showing
4 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Bun Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`build 1`] = ` | ||
"export type Str = string; | ||
export declare function hello(s: Str): Str; | ||
" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import path from 'node:path'; | ||
import { expect, test } from 'bun:test'; | ||
import dts from '../index.ts'; | ||
|
||
test('build', async () => { | ||
const input = path.resolve(__dirname, 'fixtures/main.ts'); | ||
const dist = path.resolve(__dirname, 'out'); | ||
|
||
await Bun.build({ | ||
entrypoints: [input], | ||
outdir: dist, | ||
minify: false, | ||
plugins: [dts()], | ||
target: 'bun', | ||
external: ['*'], | ||
}); | ||
|
||
const outputDts = await Bun.file(path.resolve(dist, 'main.d.ts')).text(); | ||
expect(outputDts).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export type Str = string; | ||
|
||
export function hello(s: Str): Str { | ||
return `hello${s}`; | ||
} |