ci: use node 18 for ci jobs (#23701)

This commit is contained in:
Daniel Roe 2023-10-16 22:23:38 +01:00 committed by GitHub
parent c0c5a89470
commit c1bbc5fcd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 103 additions and 103 deletions

View File

@ -34,7 +34,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: fetch tags - name: fetch tags
@ -51,7 +51,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
lint: lint:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -65,7 +65,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -76,7 +76,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: lint - name: lint
run: yarn test:lint run: yarn test:lint
@ -100,7 +100,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -111,7 +111,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: audit - name: audit
run: yarn run audit run: yarn run audit
@ -130,7 +130,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -141,7 +141,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: test unit - name: test unit
run: yarn test:unit --coverage run: yarn test:unit --coverage
@ -169,7 +169,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -180,7 +180,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: build - name: build
run: yarn test:fixtures -i run: yarn test:fixtures -i
@ -188,7 +188,7 @@ jobs:
- name: Save fixtures - name: Save fixtures
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
needs: setup needs: setup
@ -204,7 +204,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -215,12 +215,12 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: restore fixtures - name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
- name: lint app - name: lint app
@ -240,7 +240,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -251,12 +251,12 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: restore fixtures - name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
- name: test dev - name: test dev
@ -276,7 +276,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -287,12 +287,12 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: restore fixtures - name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
- name: test e2e - name: test e2e
@ -325,11 +325,11 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
registry-url: "https://registry.npmjs.org" registry-url: "https://registry.npmjs.org"

View File

@ -31,7 +31,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: install - name: install
@ -45,7 +45,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
test-unit: test-unit:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -62,7 +62,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -73,7 +73,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: test unit - name: test unit
run: yarn test:unit --testPathIgnorePatterns=packages/cli run: yarn test:unit --testPathIgnorePatterns=packages/cli
@ -95,7 +95,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -106,7 +106,7 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: build - name: build
run: yarn test:fixtures run: yarn test:fixtures
@ -114,7 +114,7 @@ jobs:
- name: Save fixtures - name: Save fixtures
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
needs: setup needs: setup
@ -133,7 +133,7 @@ jobs:
- run: corepack enable - run: corepack enable
- uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 - uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1
with: with:
node-version: 16 node-version: 18
cache: "yarn" cache: "yarn"
- name: restore workspace cache - name: restore workspace cache
@ -144,12 +144,12 @@ jobs:
packages/*/node_modules packages/*/node_modules
distributions/*/node_modules distributions/*/node_modules
packages/*/dist packages/*/dist
key: ${{ matrix.os }}-node-v16-nuxt-${{ github.sha }} key: ${{ matrix.os }}-node-v18-nuxt-${{ github.sha }}
- name: restore fixtures - name: restore fixtures
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with: with:
name: fixtures-${{ matrix.os }}-node-v16 name: fixtures-${{ matrix.os }}-node-v18
path: test/fixtures path: test/fixtures
- name: test dev - name: test dev

View File

@ -20,7 +20,7 @@ const createContext = () => ({
}) })
const createServerContext = () => ({ const createServerContext = () => ({
req: { headers: {}, url: 'http://localhost/test/server' }, req: { headers: {}, url: 'http://127.0.0.1/test/server' },
res: { headers: {}, setHeader: jest.fn(), end: jest.fn() }, res: { headers: {}, setHeader: jest.fn(), end: jest.fn() },
next: jest.fn() next: jest.fn()
}) })
@ -339,7 +339,7 @@ describe('server: nuxtMiddleware', () => {
for (const path of paths) { for (const path of paths) {
await nuxtMiddleware( await nuxtMiddleware(
{ ...req, url: 'http://localhost/test/server/' + path }, { ...req, url: 'http://127.0.0.1/test/server/' + path },
res, res,
next next
) )

View File

@ -4,7 +4,7 @@ import consola from 'consola'
import { Builder, BundleBuilder, getPort, loadFixture, Nuxt, rp, waitFor } from '../utils' import { Builder, BundleBuilder, getPort, loadFixture, Nuxt, rp, waitFor } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let builder = null let builder = null
@ -72,7 +72,7 @@ describe('basic dev', () => {
await waitFor(2000) // TODO: Find a better way await waitFor(2000) // TODO: Find a better way
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('Check build:done hook called', () => { test('Check build:done hook called', () => {

View File

@ -23,7 +23,7 @@ const resourceLoader = new ProxyLoader()
let port let port
let nuxt let nuxt
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
describe('basic ssr', () => { describe('basic ssr', () => {
beforeAll(async () => { beforeAll(async () => {

View File

@ -8,7 +8,7 @@ import { TARGETS } from '@nuxt/utils'
import { Builder, Generator, getPort, loadFixture, Nuxt, rp, listPaths, equalOrStartsWith } from '../utils' import { Builder, Generator, getPort, loadFixture, Nuxt, rp, listPaths, equalOrStartsWith } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const rootDir = resolve(__dirname, '..', 'fixtures/basic') const rootDir = resolve(__dirname, '..', 'fixtures/basic')
const distDir = resolve(rootDir, '.nuxt-generate') const distDir = resolve(rootDir, '.nuxt-generate')

View File

@ -1,7 +1,7 @@
import { getPort, loadFixture, Nuxt } from '../utils' import { getPort, loadFixture, Nuxt } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
@ -12,7 +12,7 @@ describe('plugins', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('/', async () => { test('/', async () => {

View File

@ -2,7 +2,7 @@ import { loadFixture, getPort, Nuxt, rp } from '../utils'
let port let port
let nuxt let nuxt
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const tests = [ const tests = [
['relative publicPath can be used in dev ssr', { ['relative publicPath can be used in dev ssr', {
@ -25,7 +25,7 @@ describe('basic ssr with relative path', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
const { html } = await nuxt.server.renderRoute('/') const { html } = await nuxt.server.renderRoute('/')

View File

@ -1,7 +1,7 @@
import { getPort, loadFixture, Nuxt, rp } from '../utils' import { getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const startCspServer = async (csp, isProduction = true) => { const startCspServer = async (csp, isProduction = true) => {
const options = await loadFixture('basic', { const options = await loadFixture('basic', {

View File

@ -2,7 +2,7 @@ import consola from 'consola'
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { loadFixture, getPort, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null

View File

@ -1,7 +1,7 @@
import { loadFixture, getPort, Nuxt } from '../utils' import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
// const url = (route) => 'http://localhost:' + port + route // const url = (route) => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
@ -12,7 +12,7 @@ describe('children', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('/parent', async () => { test('/parent', async () => {

View File

@ -6,7 +6,7 @@ import { getPort, rp, waitFor } from '../utils'
let port let port
const rootDir = resolve(__dirname, '..', 'fixtures/cli') const rootDir = resolve(__dirname, '..', 'fixtures/cli')
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const nuxtBin = resolve(__dirname, '../../packages/cli/bin/nuxt-cli.js') const nuxtBin = resolve(__dirname, '../../packages/cli/bin/nuxt-cli.js')
const spawnNuxt = (command, opts) => spawn(nuxtBin, [command, rootDir], opts) const spawnNuxt = (command, opts) => spawn(nuxtBin, [command, rootDir], opts)

View File

@ -4,7 +4,7 @@ import fs from 'fs'
import { getPort, loadFixture, Nuxt, rp } from '../utils' import { getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
@ -15,7 +15,7 @@ describe('custom-dirs', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('custom assets directory', async () => { test('custom assets directory', async () => {

View File

@ -1,7 +1,7 @@
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { loadFixture, getPort, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null

View File

@ -2,7 +2,7 @@ import fetch from 'node-fetch-native'
import { getPort, loadFixture, Nuxt, rp } from '../utils' import { getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + encodeURI(route) const url = route => 'http://127.0.0.1:' + port + encodeURI(route)
let nuxt = null let nuxt = null
@ -13,7 +13,7 @@ describe('encoding', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('/ö/ (router base)', async () => { test('/ö/ (router base)', async () => {

View File

@ -3,7 +3,7 @@ import consola from 'consola'
import { loadFixture, getPort, Nuxt } from '../utils' import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
// let logSpy // let logSpy
@ -15,7 +15,7 @@ describe('error', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
consola.wrapConsole() consola.wrapConsole()
}) })

View File

@ -2,7 +2,7 @@ import express from 'express'
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { loadFixture, getPort, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt let nuxt
let app let app

View File

@ -1,7 +1,7 @@
import { getPort, loadFixture, Nuxt, rp } from '../utils' import { getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
@ -13,7 +13,7 @@ describe('fallback', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('robots.txt handled', async () => { test('robots.txt handled', async () => {

View File

@ -29,7 +29,7 @@ describe('build filenames with query part', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('server manifest files exist', () => { test('server manifest files exist', () => {

View File

@ -5,7 +5,7 @@ import finalhandler from 'finalhandler'
import { Builder, Generator, getPort, loadFixture, Nuxt, waitFor } from '../utils' import { Builder, Generator, getPort, loadFixture, Nuxt, waitFor } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const rootDir = resolve(__dirname, '..', 'fixtures/full-static-with-preview') const rootDir = resolve(__dirname, '..', 'fixtures/full-static-with-preview')
const distDir = resolve(rootDir, '.nuxt-generate') const distDir = resolve(rootDir, '.nuxt-generate')

View File

@ -6,7 +6,7 @@ import glob from 'glob'
import { Builder, Generator, getPort, loadFixture, Nuxt, rp } from '../utils' import { Builder, Generator, getPort, loadFixture, Nuxt, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const rootDir = resolve(__dirname, '..', 'fixtures/full-static') const rootDir = resolve(__dirname, '..', 'fixtures/full-static')
const distDir = resolve(rootDir, '.nuxt-generate') const distDir = resolve(rootDir, '.nuxt-generate')

View File

@ -1,7 +1,7 @@
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { loadFixture, getPort, Nuxt, rp } from '../utils'
let nuxt, port let nuxt, port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
describe('modern client mode (SSR)', () => { describe('modern client mode (SSR)', () => {
beforeAll(async () => { beforeAll(async () => {
@ -10,7 +10,7 @@ describe('modern client mode (SSR)', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('should contain nomodule legacy resources', async () => { test('should contain nomodule legacy resources', async () => {

View File

@ -2,7 +2,7 @@ import consola from 'consola'
import { loadFixture, getPort, Nuxt, rp, wChunk } from '../utils' import { loadFixture, getPort, Nuxt, rp, wChunk } from '../utils'
let nuxt, port let nuxt, port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const modernUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' const modernUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
const modernInfo = mode => `Modern bundles are detected. Modern mode (\`${mode}\`) is enabled now.` const modernInfo = mode => `Modern bundles are detected. Modern mode (\`${mode}\`) is enabled now.`
@ -13,7 +13,7 @@ describe('modern server mode', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('should detect server modern mode', async () => { test('should detect server modern mode', async () => {

View File

@ -2,7 +2,7 @@ import consola from 'consola'
import { loadFixture, getPort, Nuxt, rp } from '../utils' import { loadFixture, getPort, Nuxt, rp } from '../utils'
let nuxt, port, options let nuxt, port, options
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const modernUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' const modernUA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36'
const modernInfo = mode => `Modern bundles are detected. Modern mode (\`${mode}\`) is enabled now.` const modernInfo = mode => `Modern bundles are detected. Modern mode (\`${mode}\`) is enabled now.`
@ -13,7 +13,7 @@ describe('modern client mode (SPA)', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('should detect client modern mode', async () => { test('should detect client modern mode', async () => {

View File

@ -3,7 +3,7 @@ import consola from 'consola'
import { loadFixture, getPort, Nuxt, Builder, rp } from '../utils' import { loadFixture, getPort, Nuxt, Builder, rp } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
const rootDir = resolve(__dirname, '..', 'fixtures/module') const rootDir = resolve(__dirname, '..', 'fixtures/module')
let nuxt = null let nuxt = null
@ -16,7 +16,7 @@ describe('module', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('Plugin', async () => { test('Plugin', async () => {

View File

@ -39,7 +39,7 @@ describe('nuxt', () => {
await nuxt.ready() await nuxt.ready()
const port = await getPort() const port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
const { html } = await nuxt.server.renderRoute('/') const { html } = await nuxt.server.renderRoute('/')
expect(html).toContain('<h2 class="Landscape__Title">') expect(html).toContain('<h2 class="Landscape__Title">')

View File

@ -1,7 +1,7 @@
import { getPort, loadFixture, Nuxt } from '../utils' import { getPort, loadFixture, Nuxt } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null

View File

@ -1,7 +1,7 @@
import { loadFixture, getPort, Nuxt } from '../utils' import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null

View File

@ -14,14 +14,14 @@ describe('server listen', () => {
await nuxt.ready() await nuxt.ready()
const port = await getPort() const port = await getPort()
const listen = () => nuxt.server.listen(port, 'localhost') const listen = () => nuxt.server.listen(port, '127.0.0.1')
// Listen for first time // Listen for first time
await listen() await listen()
expect(nuxt.server.listeners[0].port).toBe(port) expect(nuxt.server.listeners[0].port).toBe(port)
// Listen for second time // Listen for second time
await expect(listen()).rejects.toThrow(`Address \`localhost:${port}\` is already in use.`) await expect(listen()).rejects.toThrow(`Address \`127.0.0.1:${port}\` is already in use.`)
await nuxt.close() await nuxt.close()
}) })
@ -31,7 +31,7 @@ describe('server listen', () => {
await nuxt.ready() await nuxt.ready()
const port = await getPort() const port = await getPort()
const listen = () => nuxt.server.listen(port, 'localhost') const listen = () => nuxt.server.listen(port, '127.0.0.1')
// Listen for first time // Listen for first time
await listen() await listen()
@ -41,7 +41,7 @@ describe('server listen', () => {
await listen() await listen()
expect(nuxt.server.listeners[1].port).not.toBe(nuxt.server.listeners[0].port) expect(nuxt.server.listeners[1].port).not.toBe(nuxt.server.listeners[0].port)
expect(consola.warn).toHaveBeenCalledTimes(1) expect(consola.warn).toHaveBeenCalledTimes(1)
expect(consola.warn).toHaveBeenCalledWith(`Address \`localhost:${port}\` is already in use.`) expect(consola.warn).toHaveBeenCalledWith(`Address \`127.0.0.1:${port}\` is already in use.`)
await nuxt.close() await nuxt.close()
}) })
@ -59,7 +59,7 @@ describe('server listen', () => {
const nuxt = new Nuxt({ ...config, dev: true }) const nuxt = new Nuxt({ ...config, dev: true })
await nuxt.ready() await nuxt.ready()
const listen = () => nuxt.server.listen(0, 'localhost') // Use port 0 to let allow host to randomly assign a free PORT const listen = () => nuxt.server.listen(0, '127.0.0.1') // Use port 0 to let allow host to randomly assign a free PORT
const toString = (x = '') => `${x}` const toString = (x = '') => `${x}`
// Nuxt server should not be listening on the DEFAULT_PORT // Nuxt server should not be listening on the DEFAULT_PORT

View File

@ -4,7 +4,7 @@ import { loadFixture, getPort, Nuxt, wChunk } from '../utils'
// Runs tests in specified router mode (either "hash" or "history"). // Runs tests in specified router mode (either "hash" or "history").
function spaTests ({ isHashMode }) { function spaTests ({ isHashMode }) {
let nuxt, port let nuxt, port
const url = route => `http://localhost:${port}${isHashMode ? '/#' : ''}${route}` const url = route => `http://127.0.0.1:${port}${isHashMode ? '/#' : ''}${route}`
const renderRoute = async (_url) => { const renderRoute = async (_url) => {
const window = await nuxt.server.renderAndGetWindow(url(_url)) const window = await nuxt.server.renderAndGetWindow(url(_url))
@ -21,7 +21,7 @@ function spaTests ({ isHashMode }) {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('/ (basic spa)', async () => { test('/ (basic spa)', async () => {

View File

@ -10,7 +10,7 @@ const range = n => [...Array(n).keys()]
const FOOBAR_REGEX = /<Foobar>([\s\S]*)<\/Foobar>/ const FOOBAR_REGEX = /<Foobar>([\s\S]*)<\/Foobar>/
const match = (regex, text) => (regex.exec(text) || [])[1] const match = (regex, text) => (regex.exec(text) || [])[1]
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
// const isWindows = /^win/.test(process.platform) // const isWindows = /^win/.test(process.platform)
@ -69,7 +69,7 @@ describe('ssr', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('unique responses with data()', async () => { test('unique responses with data()', async () => {

View File

@ -6,7 +6,7 @@ import { Builder, Generator, getPort, loadFixture, Nuxt } from '../utils'
import renderAndGetWindow from '../../packages/server/src/jsdom' import renderAndGetWindow from '../../packages/server/src/jsdom'
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let builder let builder
let server = null let server = null

View File

@ -10,7 +10,7 @@ function runTest (name, expectations) {
nuxt = new Nuxt(options) nuxt = new Nuxt(options)
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
for (const route in expectations) { for (const route in expectations) {

View File

@ -8,7 +8,7 @@ import { getPort, loadFixture, Nuxt, rp } from '../utils'
const glob = pify(Glob) const glob = pify(Glob)
let port let port
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
@ -19,7 +19,7 @@ describe('with-config', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('client source map generated', async () => { test('client source map generated', async () => {

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt, waitFor } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('basic browser', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt, waitFor } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('basic browser navigation', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { getPort, loadFixture, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -14,7 +14,7 @@ const startServer = async (type = 'basic') => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
return nuxt return nuxt
} }

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt, waitFor } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page let page
@ -16,7 +16,7 @@ describe('children patch (browser)', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
}) })
test('Start browser', async () => { test('Start browser', async () => {

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('basic browser', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('basic browser', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -20,7 +20,7 @@ describe('page transitions (browser)', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('spa router base browser', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start({ await browser.start({
// slowMo: 50, // slowMo: 50,

View File

@ -3,7 +3,7 @@ import { loadFixture, getPort, Nuxt } from '../utils'
let port let port
const browser = new Browser() const browser = new Browser()
const url = route => 'http://localhost:' + port + route const url = route => 'http://127.0.0.1:' + port + route
let nuxt = null let nuxt = null
let page = null let page = null
@ -15,7 +15,7 @@ describe('split layouts error layout', () => {
await nuxt.ready() await nuxt.ready()
port = await getPort() port = await getPort()
await nuxt.server.listen(port, 'localhost') await nuxt.server.listen(port, '127.0.0.1')
await browser.start() await browser.start()
page = await browser.page(url('/')) page = await browser.page(url('/'))
}) })

View File

@ -13,7 +13,7 @@
<script> <script>
const name = process.server ? 'server' : 'client' const name = process.server ? 'server' : 'client'
const baseURL = 'http://localhost:3000/api' const baseURL = 'http://127.0.0.1:3000/api'
const getData = () => fetch(`${baseURL}/test`) const getData = () => fetch(`${baseURL}/test`)
.then(r => r.text()) .then(r => r.text())
.then(r => r + ` (From ${name})`) .then(r => r + ` (From ${name})`)