File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { exec } from 'tinyexec'
5
5
import { readPackageJSON } from 'pkg-types'
6
6
import { dirname , join } from 'pathe'
7
7
import { findStaticImports } from 'mlly'
8
+ import { version as nuxtVersion } from 'nuxt/package.json'
9
+ import { satisfies } from 'semver'
8
10
import { version } from '../package.json'
9
11
10
12
describe ( 'module builder' , ( ) => {
@@ -145,7 +147,18 @@ describe('module builder', () => {
145
147
146
148
it ( 'should generate wrapped composables' , async ( ) => {
147
149
const componentFile = await readFile ( join ( distDir , 'runtime/composables/useWrappedFetch.d.ts' ) , 'utf-8' )
148
- await expect ( componentFile ) . toMatchFileSnapshot ( '__snapshots__/useWrappedFetch.d.ts' )
150
+ if ( satisfies ( nuxtVersion , '^3' ) ) {
151
+ expect ( componentFile ) . toMatchInlineSnapshot ( `
152
+ "export declare const useWrappedFetch: () => import("nuxt/app").AsyncData<unknown, import("ofetch").FetchError<any> | null>;
153
+ "
154
+ ` )
155
+ }
156
+ else {
157
+ expect ( componentFile ) . toMatchInlineSnapshot ( `
158
+ "export declare const useWrappedFetch: () => import("nuxt/app").AsyncData<unknown, import("ofetch").FetchError<any> | undefined>;
159
+ "
160
+ ` )
161
+ }
149
162
} )
150
163
151
164
it ( 'should handle JSX correctly' , async ( ) => {
You can’t perform that action at this time.
0 commit comments