Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use node version 18.18+ #2537

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.17]
node-version: [18]
os: [ubuntu-latest]
timeout-minutes: 10

Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.17]
node-version: [18]
os: [ubuntu-latest]
timeout-minutes: 10

Expand Down Expand Up @@ -83,7 +83,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.17]
node-version: [18]
os: [ubuntu-latest]
timeout-minutes: 25

Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [18.17]
node-version: [18]
os: [ubuntu-latest]
steps:
- name: Checkout codes
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
"ts-essentials": "^9.4.0",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"undici": "^5.27.2",
"vitest": "^0.34.6",
"vue": "^3.3.4",
"vue-router": "^4.2.5"
Expand Down
14 changes: 12 additions & 2 deletions pnpm-lock.yaml

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

6 changes: 3 additions & 3 deletions specs/different_domains.runtimeConfig.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect } from 'vitest'
import { fileURLToPath } from 'node:url'
import { setup, $fetch } from './utils'
import { setup, undiciRequest } from './utils'
import { getDom } from './helper'

await setup({
Expand Down Expand Up @@ -45,12 +45,12 @@ await setup({
})

test('pass `<NuxtLink> to props using domains from runtimeConfig', async () => {
const html = await $fetch('/', {
const res = await undiciRequest('/', {
headers: {
Host: 'fr.nuxt-app.localhost'
}
})
const dom = getDom(html)
const dom = getDom(await res.body.text())
expect(dom.querySelector('#switch-locale-path-usages .switch-to-en a').getAttribute('href')).toEqual(
`http://en.staging.nuxt-app.localhost`
)
Expand Down
14 changes: 7 additions & 7 deletions specs/different_domains.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect, describe } from 'vitest'
import { fileURLToPath } from 'node:url'
import { setup, $fetch } from './utils'
import { setup, $fetch, undiciRequest } from './utils'
import { getDom } from './helper'

await setup({
Expand Down Expand Up @@ -36,12 +36,12 @@ describe('detection locale with host on server', () => {
['en', 'en.nuxt-app.localhost', 'Homepage'],
['fr', 'fr.nuxt-app.localhost', 'Accueil']
])('%s host', async (locale, host, header) => {
const html = await $fetch('/', {
const res = await undiciRequest('/', {
headers: {
Host: host
}
})
const dom = getDom(html)
const dom = getDom(await res.body.text())

expect(dom.querySelector('#lang-switcher-current-locale code').textContent).toEqual(locale)
expect(dom.querySelector('#home-header').textContent).toEqual(header)
Expand All @@ -61,12 +61,12 @@ test('detection locale with x-forwarded-host on server', async () => {
})

test('pass `<NuxtLink> to props', async () => {
const html = await $fetch('/', {
const res = await undiciRequest('/', {
headers: {
Host: 'fr.nuxt-app.localhost'
}
})
const dom = getDom(html)
const dom = getDom(await res.body.text())
expect(dom.querySelector('#switch-locale-path-usages .switch-to-en a').getAttribute('href')).toEqual(
`http://en.nuxt-app.localhost`
)
Expand All @@ -76,12 +76,12 @@ test('pass `<NuxtLink> to props', async () => {
})

test('layer provides locales with domains', async () => {
const html = await $fetch('/', {
const res = await undiciRequest('/', {
headers: {
Host: 'fr.nuxt-app.localhost'
}
})
const dom = getDom(html)
const dom = getDom(await res.body.text())

// `en` link uses project domain configuration, overrides layer
expect(dom.querySelector('#switch-locale-path-usages .switch-to-en a').getAttribute('href')).toEqual(
Expand Down
8 changes: 4 additions & 4 deletions specs/issues/2374.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { test, expect, describe } from 'vitest'
import { fileURLToPath } from 'node:url'
import { setup, $fetch } from '../utils'
import { setup, $fetch, undiciRequest } from '../utils'
import { getDom } from '../helper'

describe('#2374', async () => {
Expand All @@ -13,12 +13,12 @@ describe('#2374', async () => {
['en.nuxt-app.localhost', 'test issue 2374'],
['zh.nuxt-app.localhost', 'ๆต‹่ฏ•้—ฎ้ข˜2374']
])('%s host', async (host, header) => {
const html = await $fetch('/', {
const res = await undiciRequest('/', {
headers: {
Host: host
host: host
}
})
const dom = getDom(html)
const dom = getDom(await res.body.text())
expect(dom.querySelector('#content').textContent).toEqual(header)
})
})
Expand Down
5 changes: 5 additions & 0 deletions specs/utils/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { $fetch as _$fetch, fetch as _fetch } from 'ofetch'
import * as _kit from '@nuxt/kit'
import { resolve } from 'pathe'
import { useTestContext } from './context'
import { request } from 'undici'

// @ts-expect-error type cast
// eslint-disable-next-line
Expand Down Expand Up @@ -94,6 +95,10 @@ export function $fetch(path: string, options?: FetchOptions) {
return _$fetch(url(path), options)
}

export function undiciRequest(path: string, options?: Parameters<typeof request>[1]) {
return request(url(path), options)
}

export function url(path: string) {
const ctx = useTestContext()
if (!ctx.url) {
Expand Down