@@ -216,7 +216,7 @@ describe('transform typescript script setup', () => {
216
216
` )
217
217
} )
218
218
219
- it ( 'generates declaration' , { timeout : 10000 } , async ( ) => {
219
+ it ( 'generates declaration' , { timeout : 50_000 } , async ( ) => {
220
220
const src = `
221
221
<template>
222
222
<div :data-test="toValue('hello')" />
@@ -241,6 +241,13 @@ describe('transform typescript script setup', () => {
241
241
export default _default;
242
242
"
243
243
` )
244
+
245
+ expect ( await fixture ( `<template><div /></template>` ) ) . toMatchInlineSnapshot ( `"<template><div /></template>"` )
246
+ expect ( await declaration ( `<template><div /></template>` ) ) . toMatchInlineSnapshot ( `
247
+ "declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
248
+ export default _default;
249
+ "
250
+ ` )
244
251
} )
245
252
246
253
async function fixture ( src : string ) : Promise < string > {
@@ -256,11 +263,11 @@ describe('transform typescript script setup', () => {
256
263
return await readFile ( join ( tmpDir , 'dist/index.vue' ) , 'utf-8' )
257
264
}
258
265
259
- async function declaration ( src : string ) : Promise < string > {
266
+ async function declaration ( src : string ) : Promise < string | undefined > {
260
267
await rm ( tmpDir , { force : true , recursive : true } )
261
268
await mkdir ( join ( tmpDir , 'src' ) , { recursive : true } )
262
269
await writeFile ( join ( tmpDir , 'src/index.vue' ) , src )
263
270
await mkdist ( { declaration : true , loaders : [ 'js' , vueLoader ] , rootDir : tmpDir } )
264
- return await readFile ( join ( tmpDir , 'dist/index.vue.d.ts' ) , 'utf-8' )
271
+ return await readFile ( join ( tmpDir , 'dist/index.vue.d.ts' ) , 'utf-8' ) . catch ( ( ) => undefined )
265
272
}
266
273
} )
0 commit comments