@playpilot/tpi 8.40.0 → 8.41.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.playpilot/repo.yaml +14 -0
- package/dist/editorial.mount.js +10 -10
- package/dist/link-injections.js +2 -2
- package/dist/mount.css +1 -1
- package/dist/mount.js +8 -8
- package/package.json +3 -3
- package/src/lib/api/ads.ts +3 -1
- package/src/lib/enums/SplitTest.ts +5 -0
- package/src/lib/explore.ts +0 -4
- package/src/lib/fakeData.ts +2 -2
- package/src/lib/injection.ts +535 -535
- package/src/lib/types/config.d.ts +0 -1
- package/src/routes/components/Ads/Display.svelte +52 -5
- package/src/routes/components/Debugger.svelte +1 -9
- package/src/routes/components/Explore/ExploreLayout.svelte +10 -26
- package/src/routes/components/Explore/ExploreRouter.svelte +9 -15
- package/src/routes/components/Explore/Routes/ExploreHome.svelte +1 -1
- package/src/routes/components/Modals/RailModal.svelte +6 -2
- package/src/routes/components/Modals/TitlesRailModal.svelte +3 -1
- package/src/routes/components/Playlinks/Playlinks.svelte +11 -3
- package/src/routes/components/Rails/TitlesRail.svelte +1 -6
- package/src/routes/components/Title.svelte +10 -2
- package/src/routes/elements/+page.svelte +20 -1
- package/src/routes/explore/+page.svelte +2 -8
- package/src/tests/lib/api/ads.test.js +8 -0
- package/src/tests/routes/components/Ads/Display.test.js +166 -156
- package/svelte.config.js +32 -23
- package/vite.config.js +43 -43
|
@@ -1,156 +1,166 @@
|
|
|
1
|
-
import { fireEvent, render } from '@testing-library/svelte'
|
|
2
|
-
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
-
|
|
4
|
-
import Display from '../../../../routes/components/Ads/Display.svelte'
|
|
5
|
-
import { track } from '$lib/tracking'
|
|
6
|
-
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
7
|
-
|
|
8
|
-
vi.mock('$lib/tracking', () => ({
|
|
9
|
-
track: vi.fn(),
|
|
10
|
-
}))
|
|
11
|
-
|
|
12
|
-
export const campaign = {
|
|
13
|
-
campaign_format: 'display',
|
|
14
|
-
campaign_type: 'image',
|
|
15
|
-
campaign_platforms: ['web', 'android_app', 'ios_app'],
|
|
16
|
-
campaign_name: 'some_campaign_NL',
|
|
17
|
-
campaign_start: '2025-04-24T00:00:00Z',
|
|
18
|
-
campaign_end: '2025-04-30T23:59:00Z',
|
|
19
|
-
campaign_region: 'nl',
|
|
20
|
-
content: {
|
|
21
|
-
header: 'Some top scroll header',
|
|
22
|
-
header_logo: 'https://example.com/',
|
|
23
|
-
header_logo_uuid: '4fb7d6ea152111f08dd20a58a9feac02',
|
|
24
|
-
subheader: null,
|
|
25
|
-
image: 'https://example.com/',
|
|
26
|
-
image_uuid: '4fb7d6ea152111f08dd20a58a9feac02',
|
|
27
|
-
video: null,
|
|
28
|
-
format: null,
|
|
29
|
-
},
|
|
30
|
-
cta: {
|
|
31
|
-
header: 'Button Label',
|
|
32
|
-
subheader: null,
|
|
33
|
-
image: null,
|
|
34
|
-
image_uuid: null,
|
|
35
|
-
url: 'https://google.com/',
|
|
36
|
-
},
|
|
37
|
-
content_playlist: null,
|
|
38
|
-
provider: null,
|
|
39
|
-
impression_trackers: [],
|
|
40
|
-
target_title_uuid: null,
|
|
41
|
-
target_title_sid: null,
|
|
42
|
-
backfill_providers: [],
|
|
43
|
-
autogenerated: false,
|
|
44
|
-
enabled: true,
|
|
45
|
-
hide_imdb_score: false,
|
|
46
|
-
hide_sponsored_message: false,
|
|
47
|
-
disclaimer: 'Some disclaimer',
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
describe('Display.svelte', () => {
|
|
51
|
-
it('Should fire track event on mount', () => {
|
|
52
|
-
/** @ts-ignore */
|
|
53
|
-
render(Display, { campaign })
|
|
54
|
-
|
|
55
|
-
expect(track).toHaveBeenCalledWith(TrackingEvent.DisplayAdView, null, { campaign_name: campaign.campaign_name })
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
it('Should fire track event on click', async () => {
|
|
59
|
-
/** @ts-ignore */
|
|
60
|
-
const { getByRole } = render(Display, { campaign })
|
|
61
|
-
|
|
62
|
-
vi.resetAllMocks()
|
|
63
|
-
|
|
64
|
-
await fireEvent.click(getByRole('link'))
|
|
65
|
-
expect(track).toHaveBeenCalledWith(TrackingEvent.DisplayAdClick, null, { campaign_name: campaign.campaign_name })
|
|
66
|
-
expect(track).toHaveBeenCalledTimes(1)
|
|
67
|
-
|
|
68
|
-
await fireEvent.mouseUp(getByRole('link'), { button: 1 })
|
|
69
|
-
expect(track).toHaveBeenCalledTimes(2)
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('Should render link without any content by default', () => {
|
|
73
|
-
/** @ts-ignore */
|
|
74
|
-
const { container } = render(Display, { campaign: { cta: {}, content: {} } })
|
|
75
|
-
|
|
76
|
-
expect(/** @type {HTMLAnchorElement} */ (container.querySelector('a'))).toBeTruthy()
|
|
77
|
-
expect(/** @type {HTMLAnchorElement} */ (container.querySelector('a')).children).toHaveLength(0)
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
it('Should render disclaimer when given', () => {
|
|
81
|
-
/** @ts-ignore */
|
|
82
|
-
const { getByTestId } = render(Display, { campaign: { disclaimer: 'Some disclaimer', cta: {}, content: {} } })
|
|
83
|
-
|
|
84
|
-
expect(getByTestId('disclaimer')).toBeTruthy()
|
|
85
|
-
})
|
|
86
|
-
|
|
87
|
-
it('Should render content subheader when given', () => {
|
|
88
|
-
/** @ts-ignore */
|
|
89
|
-
const { getByText } = render(Display, { campaign: { cta: { subheader: 'Some cta subheader' }, content: {
|
|
90
|
-
|
|
91
|
-
expect(getByText('Some cta subheader')).toBeTruthy()
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
it('Should render logo when given', () => {
|
|
95
|
-
/** @ts-ignore */
|
|
96
|
-
const { getByRole } = render(Display, { campaign: { cta: {}, content: { header_logo: 'test' } } })
|
|
97
|
-
|
|
98
|
-
expect(getByRole('presentation').getAttribute('src')).toBe('test')
|
|
99
|
-
})
|
|
100
|
-
|
|
101
|
-
it('Should render background image when given', () => {
|
|
102
|
-
/** @ts-ignore */
|
|
103
|
-
const { getByRole } = render(Display, { campaign: { campaign_type: 'image', cta: {}, content: { image: 'test' } } })
|
|
104
|
-
|
|
105
|
-
expect(getByRole('presentation').getAttribute('src')).toBe('test')
|
|
106
|
-
})
|
|
107
|
-
|
|
108
|
-
it('Should render header when given', () => {
|
|
109
|
-
/** @ts-ignore */
|
|
110
|
-
const { getByText } = render(Display, { campaign: { cta: {}, content: { header: 'Some header' } } })
|
|
111
|
-
|
|
112
|
-
expect(getByText('Some header')).toBeTruthy()
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
it('Should render subheader when given', () => {
|
|
116
|
-
/** @ts-ignore */
|
|
117
|
-
const { getByText } = render(Display, { campaign: { cta: {}, content: { header: 'Some subheader' } } })
|
|
118
|
-
|
|
119
|
-
expect(getByText('Some subheader')).toBeTruthy()
|
|
120
|
-
})
|
|
121
|
-
|
|
122
|
-
it('Should render button when cta header is given', () => {
|
|
123
|
-
/** @ts-ignore */
|
|
124
|
-
const { getByText } = render(Display, { campaign: { cta: { header: 'Some button label' }, content: {} } })
|
|
125
|
-
|
|
126
|
-
expect(getByText('Some button label')).toBeTruthy()
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
it('Should not have compact class by default', () => {
|
|
130
|
-
/** @ts-ignore */
|
|
131
|
-
const { getByRole } = render(Display, { campaign })
|
|
132
|
-
|
|
133
|
-
expect(getByRole('link').classList).not.toContain('compact')
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
it('Should have compact class when prop is given', () => {
|
|
137
|
-
/** @ts-ignore */
|
|
138
|
-
const { getByRole } = render(Display, { campaign, compact: true })
|
|
139
|
-
|
|
140
|
-
expect(getByRole('link').classList).toContain('compact')
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it('Should not show disclaimer text when compact', () => {
|
|
144
|
-
/** @ts-ignore */
|
|
145
|
-
const { queryByText } = render(Display, { compact: true, campaign: { disclaimer: 'Some disclaimer', cta: {}, content: {} } })
|
|
146
|
-
|
|
147
|
-
expect(queryByText('Some disclaimer')).not.toBeTruthy()
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
it('Should render video rather than image when video is given as type', () => {
|
|
151
|
-
/** @ts-ignore */
|
|
152
|
-
const { container } = render(Display, { campaign: { campaign_type: 'video', cta: {}, content: { video: 'abc' } } })
|
|
153
|
-
|
|
154
|
-
expect(container.querySelector('video')).toBeTruthy()
|
|
155
|
-
})
|
|
156
|
-
|
|
1
|
+
import { fireEvent, render } from '@testing-library/svelte'
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import Display from '../../../../routes/components/Ads/Display.svelte'
|
|
5
|
+
import { track } from '$lib/tracking'
|
|
6
|
+
import { TrackingEvent } from '$lib/enums/TrackingEvent'
|
|
7
|
+
|
|
8
|
+
vi.mock('$lib/tracking', () => ({
|
|
9
|
+
track: vi.fn(),
|
|
10
|
+
}))
|
|
11
|
+
|
|
12
|
+
export const campaign = {
|
|
13
|
+
campaign_format: 'display',
|
|
14
|
+
campaign_type: 'image',
|
|
15
|
+
campaign_platforms: ['web', 'android_app', 'ios_app'],
|
|
16
|
+
campaign_name: 'some_campaign_NL',
|
|
17
|
+
campaign_start: '2025-04-24T00:00:00Z',
|
|
18
|
+
campaign_end: '2025-04-30T23:59:00Z',
|
|
19
|
+
campaign_region: 'nl',
|
|
20
|
+
content: {
|
|
21
|
+
header: 'Some top scroll header',
|
|
22
|
+
header_logo: 'https://example.com/',
|
|
23
|
+
header_logo_uuid: '4fb7d6ea152111f08dd20a58a9feac02',
|
|
24
|
+
subheader: null,
|
|
25
|
+
image: 'https://example.com/',
|
|
26
|
+
image_uuid: '4fb7d6ea152111f08dd20a58a9feac02',
|
|
27
|
+
video: null,
|
|
28
|
+
format: null,
|
|
29
|
+
},
|
|
30
|
+
cta: {
|
|
31
|
+
header: 'Button Label',
|
|
32
|
+
subheader: null,
|
|
33
|
+
image: null,
|
|
34
|
+
image_uuid: null,
|
|
35
|
+
url: 'https://google.com/',
|
|
36
|
+
},
|
|
37
|
+
content_playlist: null,
|
|
38
|
+
provider: null,
|
|
39
|
+
impression_trackers: [],
|
|
40
|
+
target_title_uuid: null,
|
|
41
|
+
target_title_sid: null,
|
|
42
|
+
backfill_providers: [],
|
|
43
|
+
autogenerated: false,
|
|
44
|
+
enabled: true,
|
|
45
|
+
hide_imdb_score: false,
|
|
46
|
+
hide_sponsored_message: false,
|
|
47
|
+
disclaimer: 'Some disclaimer',
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
describe('Display.svelte', () => {
|
|
51
|
+
it('Should fire track event on mount', () => {
|
|
52
|
+
/** @ts-ignore */
|
|
53
|
+
render(Display, { campaign })
|
|
54
|
+
|
|
55
|
+
expect(track).toHaveBeenCalledWith(TrackingEvent.DisplayAdView, null, { campaign_name: campaign.campaign_name })
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('Should fire track event on click', async () => {
|
|
59
|
+
/** @ts-ignore */
|
|
60
|
+
const { getByRole } = render(Display, { campaign })
|
|
61
|
+
|
|
62
|
+
vi.resetAllMocks()
|
|
63
|
+
|
|
64
|
+
await fireEvent.click(getByRole('link'))
|
|
65
|
+
expect(track).toHaveBeenCalledWith(TrackingEvent.DisplayAdClick, null, { campaign_name: campaign.campaign_name })
|
|
66
|
+
expect(track).toHaveBeenCalledTimes(1)
|
|
67
|
+
|
|
68
|
+
await fireEvent.mouseUp(getByRole('link'), { button: 1 })
|
|
69
|
+
expect(track).toHaveBeenCalledTimes(2)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('Should render link without any content by default', () => {
|
|
73
|
+
/** @ts-ignore */
|
|
74
|
+
const { container } = render(Display, { campaign: { cta: {}, content: {} } })
|
|
75
|
+
|
|
76
|
+
expect(/** @type {HTMLAnchorElement} */ (container.querySelector('a'))).toBeTruthy()
|
|
77
|
+
expect(/** @type {HTMLAnchorElement} */ (container.querySelector('a')).children).toHaveLength(0)
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
it('Should render disclaimer when given', () => {
|
|
81
|
+
/** @ts-ignore */
|
|
82
|
+
const { getByTestId } = render(Display, { campaign: { disclaimer: 'Some disclaimer', cta: {}, content: {} } })
|
|
83
|
+
|
|
84
|
+
expect(getByTestId('disclaimer')).toBeTruthy()
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('Should render content subheader when given', () => {
|
|
88
|
+
/** @ts-ignore */
|
|
89
|
+
const { getByText } = render(Display, { campaign: { cta: { subheader: 'Some cta subheader' }, content: {} } })
|
|
90
|
+
|
|
91
|
+
expect(getByText('Some cta subheader')).toBeTruthy()
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('Should render logo when given', () => {
|
|
95
|
+
/** @ts-ignore */
|
|
96
|
+
const { getByRole } = render(Display, { campaign: { cta: {}, content: { header_logo: 'test' } } })
|
|
97
|
+
|
|
98
|
+
expect(getByRole('presentation').getAttribute('src')).toBe('test')
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it('Should render background image when given', () => {
|
|
102
|
+
/** @ts-ignore */
|
|
103
|
+
const { getByRole } = render(Display, { campaign: { campaign_type: 'image', cta: {}, content: { image: 'test' } } })
|
|
104
|
+
|
|
105
|
+
expect(getByRole('presentation').getAttribute('src')).toBe('test')
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
it('Should render header when given', () => {
|
|
109
|
+
/** @ts-ignore */
|
|
110
|
+
const { getByText } = render(Display, { campaign: { cta: {}, content: { header: 'Some header' } } })
|
|
111
|
+
|
|
112
|
+
expect(getByText('Some header')).toBeTruthy()
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('Should render subheader when given', () => {
|
|
116
|
+
/** @ts-ignore */
|
|
117
|
+
const { getByText } = render(Display, { campaign: { cta: {}, content: { header: 'Some subheader' } } })
|
|
118
|
+
|
|
119
|
+
expect(getByText('Some subheader')).toBeTruthy()
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('Should render button when cta header is given', () => {
|
|
123
|
+
/** @ts-ignore */
|
|
124
|
+
const { getByText } = render(Display, { campaign: { cta: { header: 'Some button label' }, content: {} } })
|
|
125
|
+
|
|
126
|
+
expect(getByText('Some button label')).toBeTruthy()
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
it('Should not have compact class by default', () => {
|
|
130
|
+
/** @ts-ignore */
|
|
131
|
+
const { getByRole } = render(Display, { campaign })
|
|
132
|
+
|
|
133
|
+
expect(getByRole('link').classList).not.toContain('compact')
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('Should have compact class when prop is given', () => {
|
|
137
|
+
/** @ts-ignore */
|
|
138
|
+
const { getByRole } = render(Display, { campaign, compact: true })
|
|
139
|
+
|
|
140
|
+
expect(getByRole('link').classList).toContain('compact')
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
it('Should not show disclaimer text when compact', () => {
|
|
144
|
+
/** @ts-ignore */
|
|
145
|
+
const { queryByText } = render(Display, { compact: true, campaign: { disclaimer: 'Some disclaimer', cta: {}, content: {} } })
|
|
146
|
+
|
|
147
|
+
expect(queryByText('Some disclaimer')).not.toBeTruthy()
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
it('Should render video rather than image when video is given as type', () => {
|
|
151
|
+
/** @ts-ignore */
|
|
152
|
+
const { container } = render(Display, { campaign: { campaign_type: 'video', cta: {}, content: { video: 'abc' } } })
|
|
153
|
+
|
|
154
|
+
expect(container.querySelector('video')).toBeTruthy()
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
it('Should render with expected content when slim variant is given', () => {
|
|
158
|
+
/** @ts-ignore */
|
|
159
|
+
const { container, queryByText } = render(Display, { slim: true, campaign: { campaign_type: 'video', cta: { header: 'Some header', subheader: 'Some cta subheader' }, content: { header_logo: 'dfg', video: 'abc' } } })
|
|
160
|
+
|
|
161
|
+
expect(container.querySelector('.slim')).toBeTruthy()
|
|
162
|
+
expect(container.querySelector('.logo')).toBeTruthy()
|
|
163
|
+
expect(queryByText('Some header')).toBeTruthy()
|
|
164
|
+
expect(queryByText('Some cta header')).not.toBeTruthy()
|
|
165
|
+
})
|
|
166
|
+
})
|
package/svelte.config.js
CHANGED
|
@@ -1,23 +1,32 @@
|
|
|
1
|
-
import adapter from '@sveltejs/adapter-auto'
|
|
2
|
-
import { sveltePreprocess
|
|
3
|
-
|
|
4
|
-
/** @type {import('@sveltejs/kit').Config} */
|
|
5
|
-
const config = {
|
|
6
|
-
preprocess: sveltePreprocess({
|
|
7
|
-
scss: {
|
|
8
|
-
includePaths: ['src'],
|
|
9
|
-
prependData: `
|
|
10
|
-
@use "src/lib/scss/_functions.scss" as *;
|
|
11
|
-
@use "src/lib/scss/_mixins.scss" as *;
|
|
12
|
-
`,
|
|
13
|
-
},
|
|
14
|
-
}),
|
|
15
|
-
kit: {
|
|
16
|
-
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
|
17
|
-
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
|
18
|
-
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
|
19
|
-
adapter: adapter(),
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
import adapter from '@sveltejs/adapter-auto'
|
|
2
|
+
import { sveltePreprocess } from 'svelte-preprocess'
|
|
3
|
+
|
|
4
|
+
/** @type {import('@sveltejs/kit').Config} */
|
|
5
|
+
const config = {
|
|
6
|
+
preprocess: sveltePreprocess({
|
|
7
|
+
scss: {
|
|
8
|
+
includePaths: ['src'],
|
|
9
|
+
prependData: `
|
|
10
|
+
@use "src/lib/scss/_functions.scss" as *;
|
|
11
|
+
@use "src/lib/scss/_mixins.scss" as *;
|
|
12
|
+
`,
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
kit: {
|
|
16
|
+
// adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list.
|
|
17
|
+
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
|
|
18
|
+
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
|
|
19
|
+
adapter: adapter(),
|
|
20
|
+
},
|
|
21
|
+
compilerOptions: {
|
|
22
|
+
warningFilter: (warning) => {
|
|
23
|
+
const ignore = [
|
|
24
|
+
'state_referenced_locally',
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
return !ignore.includes(warning.code)
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default config
|
package/vite.config.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
import path from 'path'
|
|
2
|
-
import * as dotenv from 'dotenv'
|
|
3
|
-
import { defineConfig } from 'vitest/config'
|
|
4
|
-
import { sveltekit } from '@sveltejs/kit/vite'
|
|
5
|
-
import packageJson from './package.json'
|
|
6
|
-
|
|
7
|
-
dotenv.config({ path: '.env' })
|
|
8
|
-
|
|
9
|
-
export default defineConfig(() => ({
|
|
10
|
-
plugins: [
|
|
11
|
-
sveltekit(),
|
|
12
|
-
],
|
|
13
|
-
|
|
14
|
-
server: {
|
|
15
|
-
port: 3000,
|
|
16
|
-
allowedHosts: ['engage-moderate-happy-davis.trycloudflare.com'],
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
test: {
|
|
20
|
-
environment: 'happy-dom',
|
|
21
|
-
environmentOptions: {
|
|
22
|
-
happyDOM: {
|
|
23
|
-
settings: {
|
|
24
|
-
disableJavaScriptFileLoading: true,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
29
|
-
setupFiles: ['src/tests/setup.js'],
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
resolve: {
|
|
33
|
-
conditions: process.env.VITEST ? ['browser'] : [],
|
|
34
|
-
alias: {
|
|
35
|
-
'$lib': path.resolve(__dirname, './src/lib'),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
define: {
|
|
40
|
-
__SCRIPT_VERSION__: JSON.stringify(packageJson.version),
|
|
41
|
-
__IS_EDITORIAL_SCRIPT__: true,
|
|
42
|
-
},
|
|
43
|
-
}))
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import * as dotenv from 'dotenv'
|
|
3
|
+
import { defineConfig } from 'vitest/config'
|
|
4
|
+
import { sveltekit } from '@sveltejs/kit/vite'
|
|
5
|
+
import packageJson from './package.json'
|
|
6
|
+
|
|
7
|
+
dotenv.config({ path: '.env' })
|
|
8
|
+
|
|
9
|
+
export default defineConfig(() => ({
|
|
10
|
+
plugins: [
|
|
11
|
+
sveltekit(),
|
|
12
|
+
],
|
|
13
|
+
|
|
14
|
+
server: {
|
|
15
|
+
port: 3000,
|
|
16
|
+
allowedHosts: ['engage-moderate-happy-davis.trycloudflare.com'],
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
test: {
|
|
20
|
+
environment: 'happy-dom',
|
|
21
|
+
environmentOptions: {
|
|
22
|
+
happyDOM: {
|
|
23
|
+
settings: {
|
|
24
|
+
disableJavaScriptFileLoading: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
29
|
+
setupFiles: ['src/tests/setup.js'],
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
resolve: {
|
|
33
|
+
conditions: process.env.VITEST ? ['browser'] : [],
|
|
34
|
+
alias: {
|
|
35
|
+
'$lib': path.resolve(__dirname, './src/lib'),
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
define: {
|
|
40
|
+
__SCRIPT_VERSION__: JSON.stringify(packageJson.version),
|
|
41
|
+
__IS_EDITORIAL_SCRIPT__: true,
|
|
42
|
+
},
|
|
43
|
+
}))
|