@@ -216,7 +216,7 @@ describe('transform typescript script setup', () => {
216216 ` )
217217 } )
218218
219- it ( 'generates declaration' , { timeout : 10000 } , async ( ) => {
219+ it ( 'generates declaration' , { timeout : 50_000 } , async ( ) => {
220220 const src = `
221221 <template>
222222 <div :data-test="toValue('hello')" />
@@ -241,6 +241,13 @@ describe('transform typescript script setup', () => {
241241 export default _default;
242242 "
243243 ` )
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+ ` )
244251 } )
245252
246253 async function fixture ( src : string ) : Promise < string > {
@@ -256,11 +263,11 @@ describe('transform typescript script setup', () => {
256263 return await readFile ( join ( tmpDir , 'dist/index.vue' ) , 'utf-8' )
257264 }
258265
259- async function declaration ( src : string ) : Promise < string > {
266+ async function declaration ( src : string ) : Promise < string | undefined > {
260267 await rm ( tmpDir , { force : true , recursive : true } )
261268 await mkdir ( join ( tmpDir , 'src' ) , { recursive : true } )
262269 await writeFile ( join ( tmpDir , 'src/index.vue' ) , src )
263270 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 )
265272 }
266273} )
0 commit comments