test: remove JS payload test + add non-async context test (#22530)

This commit is contained in:
Daniel Roe 2023-08-08 10:45:37 +01:00 committed by GitHub
parent 37ba586300
commit 53c706b575
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 8 deletions

View File

@ -169,7 +169,7 @@ jobs:
os: [ubuntu-latest, windows-latest] os: [ubuntu-latest, windows-latest]
env: ['dev', 'built'] env: ['dev', 'built']
builder: ['vite', 'webpack'] builder: ['vite', 'webpack']
payload: ['json', 'js'] context: ['async', 'default']
node: [16] node: [16]
exclude: exclude:
- env: 'dev' - env: 'dev'
@ -231,8 +231,8 @@ jobs:
env: env:
TEST_ENV: ${{ matrix.env }} TEST_ENV: ${{ matrix.env }}
TEST_BUILDER: ${{ matrix.builder }} TEST_BUILDER: ${{ matrix.builder }}
TEST_PAYLOAD: ${{ matrix.payload }} TEST_CONTEXT: ${{ matrix.context }}
SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.payload == 'js' || runner.os == 'Windows' }} SKIP_BUNDLE_SIZE: ${{ github.event_name != 'push' || matrix.env == 'dev' || matrix.builder == 'webpack' || matrix.context == 'default' || runner.os == 'Windows' }}
build-release: build-release:
permissions: permissions:

View File

@ -20,7 +20,6 @@
"play:preview": "nuxi preview playground", "play:preview": "nuxi preview playground",
"test": "pnpm test:fixtures && pnpm test:fixtures:payload && pnpm test:fixtures:dev && pnpm test:fixtures:webpack && pnpm test:unit && pnpm typecheck", "test": "pnpm test:fixtures && pnpm test:fixtures:payload && pnpm test:fixtures:dev && pnpm test:fixtures:webpack && pnpm test:unit && pnpm typecheck",
"test:fixtures": "nuxi prepare test/fixtures/basic && nuxi prepare test/fixtures/runtime-compiler && vitest run --dir test", "test:fixtures": "nuxi prepare test/fixtures/basic && nuxi prepare test/fixtures/runtime-compiler && vitest run --dir test",
"test:fixtures:payload": "TEST_PAYLOAD=js pnpm test:fixtures",
"test:fixtures:dev": "TEST_ENV=dev pnpm test:fixtures", "test:fixtures:dev": "TEST_ENV=dev pnpm test:fixtures",
"test:fixtures:webpack": "TEST_BUILDER=webpack pnpm test:fixtures", "test:fixtures:webpack": "TEST_BUILDER=webpack pnpm test:fixtures",
"test:runtime": "vitest -c vitest.nuxt.config.ts", "test:runtime": "vitest -c vitest.nuxt.config.ts",

View File

@ -1901,7 +1901,7 @@ describe.skipIf(isDev() || isWindows || !isRenderingJson)('payload rendering', (
}) })
}) })
describe('Async context', () => { describe.skipIf(process.env.TEST_CONTEXT !== 'async')('Async context', () => {
it('should be available', async () => { it('should be available', async () => {
expect(await $fetch('/async-context')).toContain('"hasApp": true') expect(await $fetch('/async-context')).toContain('"hasApp": true')
}) })

View File

@ -179,7 +179,6 @@ export default defineNuxtConfig({
experimental: { experimental: {
typedPages: true, typedPages: true,
polyfillVueUseHead: true, polyfillVueUseHead: true,
renderJsonPayloads: process.env.TEST_PAYLOAD !== 'js',
respectNoSSRHeader: true, respectNoSSRHeader: true,
clientFallback: true, clientFallback: true,
restoreState: true, restoreState: true,
@ -188,7 +187,7 @@ export default defineNuxtConfig({
reactivityTransform: true, reactivityTransform: true,
treeshakeClientOnly: true, treeshakeClientOnly: true,
payloadExtraction: true, payloadExtraction: true,
asyncContext: true, asyncContext: process.env.TEST_CONTEXT === 'async',
headCapoPlugin: true headCapoPlugin: true
}, },
appConfig: { appConfig: {

View File

@ -6,7 +6,7 @@ import { reactive, ref, shallowReactive, shallowRef } from 'vue'
import { createError } from 'h3' import { createError } from 'h3'
import { createPage, getBrowser, url, useTestContext } from '@nuxt/test-utils' import { createPage, getBrowser, url, useTestContext } from '@nuxt/test-utils'
export const isRenderingJson = process.env.TEST_PAYLOAD !== 'js' export const isRenderingJson = true
export async function renderPage (path = '/') { export async function renderPage (path = '/') {
const ctx = useTestContext() const ctx = useTestContext()