Skip to content

Commit

Permalink
test: improve test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ocavue committed Nov 20, 2023
1 parent c6237b8 commit 4247d8f
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions test/index.test.ts
Expand Up @@ -1669,35 +1669,24 @@ test('should only include exported declarations with experimentalDts', async ()
expect(entry2dts).not.toContain('declare1')
})

test('should only include exported declarations with experimentalDts', async () => {
test('--experimental-dts should work when --clean is provided', async () => {
const files = {
'package.json': `{ "name": "tsup-playground", "private": true }`,
'tsconfig.json': `{ "compilerOptions": { "skipLibCheck": true } }`,
'src/index.ts': `export const foo = 1`,
'input.ts': `export const foo = 1`,
}
const withoutClean = await run(getTestName(), files, {
entry: ['src/index.ts'],
flags: ['--experimental-dts'],
})

const withClean = await run(getTestName(), files, {
entry: ['src/index.ts'],
flags: ['--experimental-dts', '--clean'],
})

expect(withoutClean.outFiles).toMatchInlineSnapshot(`
[
"_tsup-dts-rollup.d.ts",
"index.js",
"src/index.d.ts",
]
`)
expect(withClean.outFiles).toEqual(withoutClean.outFiles)
expect(withClean.outFiles).toMatchInlineSnapshot(`
[
"_tsup-dts-rollup.d.ts",
"index.js",
"src/index.d.ts",
"input.d.ts",
"input.js",
]
`)
expect(withClean.outFiles).toEqual(withoutClean.outFiles)
})

0 comments on commit 4247d8f

Please sign in to comment.