Skip to content

Commit 2b7002c

Browse files
committed
chore: fix tests
1 parent e14cd1b commit 2b7002c

File tree

10 files changed

+55
-54
lines changed

10 files changed

+55
-54
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
"prepack": "nuxt-module-build build && npm run client:build",
4747
"dev": "nuxi dev playground",
4848
"dev:ssl": "nuxi dev playground --https",
49-
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
49+
"prepare:fixtures": "nuxi prepare test/fixtures/basic && nuxi prepare test/fixtures/cdn && nuxi prepare test/fixtures/extend-registry",
50+
"dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground && pnpm run prepare:fixtures",
5051
"typecheck": "vue-tsc --noEmit",
5152
"bump": "bumpp package.json --commit --push --tag",
5253
"release": "pnpm build && bumpp -x \"npx changelogen --output=CHANGELOG.md\" && pnpm publish",

src/plugins/check-scripts.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { createUnplugin } from 'unplugin'
2-
import { type Node, walk } from 'estree-walker'
2+
import { walk } from 'estree-walker'
3+
import type { Node } from 'estree-walker'
34
import type { AssignmentExpression, CallExpression, ObjectPattern, ArrowFunctionExpression, Identifier, MemberExpression } from 'estree'
45
import { isVue } from './util'
56

src/runtime/components/ScriptYouTubePlayer.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ import { useScriptTriggerElement } from '../composables/useScriptTriggerElement'
1212
import { useScriptYouTubePlayer } from '../registry/youtube-player'
1313
import ScriptAriaLoadingIndicator from './ScriptAriaLoadingIndicator.vue'
1414
15-
export type YoutubeThumbnailSize =
15+
export type YoutubeThumbnailSize
1616
// 120x90
17-
'1' | '2' | '3' | 'default' |
17+
= '1' | '2' | '3' | 'default'
1818
// 320x180
19-
'mq1' | 'mq2' | 'mq3' | 'mqdefault' |
19+
| 'mq1' | 'mq2' | 'mq3' | 'mqdefault'
2020
// 480x360
21-
'0' | 'hq1' | 'hq2' | 'hq3' | 'hqdefault' |
21+
| '0' | 'hq1' | 'hq2' | 'hq3' | 'hqdefault'
2222
// 640x480
23-
'sd1' | 'sd2' | 'sd3' | 'sddefault' |
23+
| 'sd1' | 'sd2' | 'sd3' | 'sddefault'
2424
// 1280x720
25-
'hq720' |
25+
| 'hq720'
2626
// 1920x1080
27-
'maxresdefault'
27+
| 'maxresdefault'
2828
2929
const props = withDefaults(defineProps<{
3030
placeholderAttrs?: ImgHTMLAttributes

src/runtime/registry/google-analytics.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,27 @@ export interface EventParameters extends GtagCustomParams {
5050
}
5151

5252
// Default events in GA4
53-
export type DefaultEventName =
54-
| 'add_payment_info'
55-
| 'add_shipping_info'
56-
| 'add_to_cart'
57-
| 'add_to_wishlist'
58-
| 'begin_checkout'
59-
| 'purchase'
60-
| 'refund'
61-
| 'remove_from_cart'
62-
| 'select_item'
63-
| 'select_promotion'
64-
| 'view_cart'
65-
| 'view_item'
66-
| 'view_item_list'
67-
| 'view_promotion'
68-
| 'login'
69-
| 'sign_up'
70-
| 'search'
71-
| 'page_view'
72-
| 'screen_view'
73-
| string // Allow custom event names
53+
export type DefaultEventName
54+
= | 'add_payment_info'
55+
| 'add_shipping_info'
56+
| 'add_to_cart'
57+
| 'add_to_wishlist'
58+
| 'begin_checkout'
59+
| 'purchase'
60+
| 'refund'
61+
| 'remove_from_cart'
62+
| 'select_item'
63+
| 'select_promotion'
64+
| 'view_cart'
65+
| 'view_item'
66+
| 'view_item_list'
67+
| 'view_promotion'
68+
| 'login'
69+
| 'sign_up'
70+
| 'search'
71+
| 'page_view'
72+
| 'screen_view'
73+
| string // Allow custom event names
7474

7575
// Define the GTag function interface with proper overloads
7676
export interface GTag {

src/runtime/registry/meta-pixel.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@ interface EventObjectProperties {
2020
}
2121
type ConsentAction = 'grant' | 'revoke'
2222

23-
type FbqArgs =
24-
| ['track', StandardEvents, EventObjectProperties?]
25-
| ['trackCustom', string, EventObjectProperties?]
26-
| ['trackSingle', string, StandardEvents, EventObjectProperties?]
27-
| ['trackSingleCustom', string, string, EventObjectProperties?]
28-
| ['init', string]
29-
| ['init', number, Record<string, any>?]
30-
| ['consent', ConsentAction]
23+
type FbqArgs
24+
= | ['track', StandardEvents, EventObjectProperties?]
25+
| ['trackCustom', string, EventObjectProperties?]
26+
| ['trackSingle', string, StandardEvents, EventObjectProperties?]
27+
| ['trackSingleCustom', string, string, EventObjectProperties?]
28+
| ['init', string]
29+
| ['init', number, Record<string, any>?]
30+
| ['consent', ConsentAction]
3131
// fallback: allow any fbq call signature not covered above
32-
| [string, ...any[]]
32+
| [string, ...any[]]
3333
type FbqFns = (...args: FbqArgs) => void
3434

3535
export interface MetaPixelApi {

src/runtime/registry/plausible-analytics.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export const PlausibleAnalyticsOptions = object({
2222
export type PlausibleAnalyticsInput = RegistryScriptInput<typeof PlausibleAnalyticsOptions, false>
2323

2424
export interface PlausibleAnalyticsApi {
25-
plausible: ((event: '404', options: Record<string, any>) => void) &
26-
((event: 'event', options: Record<string, any>) => void) &
27-
((...params: any[]) => void) & {
25+
plausible: ((event: '404', options: Record<string, any>) => void)
26+
& ((event: 'event', options: Record<string, any>) => void)
27+
& ((...params: any[]) => void) & {
2828
q: any[]
2929
}
3030
}

src/runtime/registry/snapchat-pixel.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ export const InitObjectPropertiesSchema = object({
4242

4343
type InitObjectProperties = InferInput<typeof InitObjectPropertiesSchema>
4444

45-
type SnapTrFns =
46-
((event: 'track', eventName: StandardEvents | '', data?: EventObjectProperties) => void) &
47-
((event: 'init', id: string, data?: Record<string, any>) => void) &
48-
((event: 'init', id: string, data?: InitObjectProperties) => void) &
49-
((event: string, ...params: any[]) => void)
45+
type SnapTrFns
46+
= ((event: 'track', eventName: StandardEvents | '', data?: EventObjectProperties) => void)
47+
& ((event: 'init', id: string, data?: Record<string, any>) => void)
48+
& ((event: 'init', id: string, data?: InitObjectProperties) => void)
49+
& ((event: string, ...params: any[]) => void)
5050

5151
export interface SnapPixelApi {
5252
snaptr: SnapTrFns & {

src/runtime/registry/x-pixel.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ interface EventObjectProperties {
2222
contents: ContentProperties[]
2323
}
2424

25-
type TwqFns =
26-
((event: 'event', eventId: string, data?: EventObjectProperties) => void)
27-
& ((event: 'config', id: string) => void)
28-
& ((event: string, ...params: any[]) => void)
25+
type TwqFns
26+
= ((event: 'event', eventId: string, data?: EventObjectProperties) => void)
27+
& ((event: 'config', id: string) => void)
28+
& ((event: string, ...params: any[]) => void)
2929

3030
export interface XPixelApi {
3131
twq: TwqFns & {

src/runtime/types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ export type RegistryScriptInput<
172172
Bundelable extends boolean = true,
173173
Usable extends boolean = false,
174174
CanBypassOptions extends boolean = true,
175-
> =
176-
(InferIfSchema<T>
175+
>
176+
= (InferIfSchema<T>
177177
& {
178178
/**
179179
* A unique key to use for the script, this can be used to load multiple of the same script with different options.

test/e2e/cdn.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { fileURLToPath } from 'node:url'
21
import { describe, expect, it } from 'vitest'
32
import { createResolver } from '@nuxt/kit'
43
import { $fetch, setup } from '@nuxt/test-utils/e2e'

0 commit comments

Comments
 (0)