Skip to content

Commit

Permalink
fix(e2e,config): provide fallback compatibilityDate
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Aug 13, 2024
1 parent 587a0b5 commit 8e01e3f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@vitest/ui": "2.0.4",
"@vue/test-utils": "2.4.6",
"changelogen": "0.5.5",
"compatx": "^0.1.8",
"eslint": "9.7.0",
"h3": "1.12.0",
"jiti": "1.21.6",
Expand Down
5 changes: 4 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { defineConfig } from 'vite'
import { setupDotenv } from 'c12'
import type { DotenvOptions } from 'c12'
import type { InlineConfig } from 'vite'
import type { DateString } from 'compatx'
import { defu } from 'defu'
import { createResolver } from '@nuxt/kit'

Expand Down Expand Up @@ -32,6 +33,10 @@ async function startNuxtAndGetViteConfig(
cwd: rootDir,
fileName: '.env.test',
}),
defaults: {
// suppress compatibility date warning for runtime environment tests
compatibilityDate: '2024-04-03' as DateString,
},
overrides: defu(
{
appId: 'nuxt-app',
Expand Down
6 changes: 5 additions & 1 deletion src/core/context.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { resolve } from 'node:path'
import { defu } from 'defu'
import { withTrailingSlash } from 'ufo'
import type { DateString } from 'compatx'
import type { TestContext, TestOptions } from './types'

let currentContext: TestContext | undefined
Expand All @@ -15,7 +16,10 @@ export function createTestContext(options: Partial<TestOptions>): TestContext {
logLevel: 1,
server: true,
build: (options.browser !== false) || (options.server !== false),
nuxtConfig: {},
nuxtConfig: {
// suppress compatibility date warning for runtime environment tests
compatibilityDate: '2024-04-03' as DateString,
},
browserOptions: {
type: 'chromium' as const,
},
Expand Down

0 comments on commit 8e01e3f

Please sign in to comment.