Unverified Commit 8c6da3f7 authored by Steven's avatar Steven Committed by GitHub

chore(test): move build-spinners node-pty test to isolated (#53408)

Co-authored-by: 's avatarJJ Kasper <22380829+ijjk@users.noreply.github.com>
parent 3b1ccbf9
......@@ -169,7 +169,6 @@
"nanoid": "3.1.30",
"next": "workspace:*",
"node-fetch": "2.6.7",
"node-pty": "0.10.1",
"npm-run-all": "4.1.5",
"nprogress": "0.2.0",
"open": "9.0.0",
......
......@@ -127,7 +127,6 @@ importers:
nanoid: 3.1.30
next: workspace:*
node-fetch: 2.6.7
node-pty: 0.10.1
npm-run-all: 4.1.5
nprogress: 0.2.0
open: 9.0.0
......@@ -299,7 +298,6 @@ importers:
nanoid: 3.1.30
next: link:packages/next
node-fetch: 2.6.7
node-pty: 0.10.1
npm-run-all: 4.1.5
nprogress: 0.2.0
open: 9.0.0
......@@ -6162,7 +6160,7 @@ packages:
dependencies:
'@mdx-js/mdx': 2.2.1
source-map: 0.7.3
webpack: 5.86.0
webpack: 5.86.0_@swc+core@1.3.55
transitivePeerDependencies:
- supports-color
......@@ -6908,7 +6906,6 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@swc/core-darwin-x64/1.3.55:
......@@ -6917,7 +6914,6 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: true
optional: true
/@swc/core-linux-arm-gnueabihf/1.3.55:
......@@ -6926,7 +6922,6 @@ packages:
cpu: [arm]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@swc/core-linux-arm64-gnu/1.3.55:
......@@ -6935,7 +6930,6 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@swc/core-linux-arm64-musl/1.3.55:
......@@ -6944,7 +6938,6 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@swc/core-linux-x64-gnu/1.3.55:
......@@ -6953,7 +6946,6 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@swc/core-linux-x64-musl/1.3.55:
......@@ -6962,7 +6954,6 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: true
optional: true
/@swc/core-win32-arm64-msvc/1.3.55:
......@@ -6971,7 +6962,6 @@ packages:
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@swc/core-win32-ia32-msvc/1.3.55:
......@@ -6980,7 +6970,6 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@swc/core-win32-x64-msvc/1.3.55:
......@@ -6989,7 +6978,6 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
dev: true
optional: true
/@swc/core/1.3.55_@swc+helpers@0.5.1:
......@@ -7014,7 +7002,6 @@ packages:
'@swc/core-win32-arm64-msvc': 1.3.55
'@swc/core-win32-ia32-msvc': 1.3.55
'@swc/core-win32-x64-msvc': 1.3.55
dev: true
/@swc/helpers/0.4.14:
resolution: {integrity: sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==}
......@@ -18168,11 +18155,6 @@ packages:
/mute-stream/0.0.8:
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
/nan/2.15.0:
resolution: {integrity: sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==}
requiresBuild: true
dev: true
/nanoid/3.1.30:
resolution: {integrity: sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
......@@ -18446,13 +18428,6 @@ packages:
upper-case: 2.0.2
dev: true
/node-pty/0.10.1:
resolution: {integrity: sha512-JTdtUS0Im/yRsWJSx7yiW9rtpfmxqxolrtnyKwPLI+6XqTAPW/O2MjS8FYL4I5TsMbH2lVgDb2VMjp+9LoQGNg==}
requiresBuild: true
dependencies:
nan: 2.15.0
dev: true
/node-releases/2.0.3:
resolution: {integrity: sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==}
......@@ -23915,7 +23890,6 @@ packages:
serialize-javascript: 6.0.1
terser: 5.17.7
webpack: 5.86.0_@swc+core@1.3.55
dev: true
/terser/5.10.0:
resolution: {integrity: sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==}
......@@ -25287,7 +25261,6 @@ packages:
- '@swc/core'
- esbuild
- uglify-js
dev: true
/websocket-driver/0.7.3:
resolution: {integrity: sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==}
......
import * as pty from 'node-pty'
import fs from 'fs-extra'
import path from 'path'
import fs from 'fs-extra'
import stripAnsi from 'strip-ansi'
import resolveFrom from 'resolve-from'
import { NextInstance, createNext } from 'e2e-utils'
type File = {
filename: string
......@@ -44,54 +45,73 @@ const pagesFiles: File[] = [
},
]
it.each([
{ name: 'app dir', files: appDirFiles },
{
name: 'app dir (compile workers)',
files: [
...appDirFiles,
{
filename: 'next.config.js',
content: `
let next: NextInstance
describe('build-spinners', () => {
beforeAll(async () => {
next = await createNext({
skipStart: true,
files: {},
dependencies: {
'node-pty': '0.10.1',
},
})
})
afterAll(() => next.destroy())
beforeEach(async () => {
await fs.remove(path.join(next.testDir, 'pages'))
await fs.remove(path.join(next.testDir, 'app'))
})
it.each([
{ name: 'app dir', files: appDirFiles },
{
name: 'app dir (compile workers)',
files: [
...appDirFiles,
{
filename: 'next.config.js',
content: `
module.exports = {
experimental: {
webpackBuildWorker: true,
}
}
`,
},
],
},
{
name: 'page dir',
files: [
...pagesFiles,
{
filename: 'next.config.js',
content: `
},
],
},
{
name: 'page dir',
files: [
...pagesFiles,
{
filename: 'next.config.js',
content: `
module.exports = {
experimental: {
webpackBuildWorker: true,
}
}
`,
},
],
},
{ name: 'page dir (compile workers)', files: pagesFiles },
{ name: 'app and pages', files: [...appDirFiles, ...pagesFiles] },
])('should handle build spinners correctly $name', async ({ files }) => {
const appDir = path.join(__dirname, 'app')
await fs.remove(appDir)
try {
for (const file of files) {
await fs.ensureDir(path.dirname(path.join(appDir, file.filename)))
await fs.writeFile(path.join(appDir, file.filename), file.content)
},
],
},
{ name: 'page dir (compile workers)', files: pagesFiles },
{ name: 'app and pages', files: [...appDirFiles, ...pagesFiles] },
])('should handle build spinners correctly $name', async ({ files }) => {
for (const { filename, content } of files) {
await next.patchFile(filename, content)
}
const nextBin = require.resolve('next/dist/bin/next')
const appDir = next.testDir
const nextBin = resolveFrom(appDir, 'next/dist/bin/next')
const ptyPath = resolveFrom(appDir, 'node-pty')
console.log({ appDir, ptyPath, nextBin })
const pty = require(ptyPath)
const output = []
const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
name: 'xterm-color',
......@@ -170,7 +190,5 @@ it.each([
expect(compiledIdx).toBeLessThan(collectingPageDataIdx)
expect(collectingPageDataIdx).toBeLessThan(generatingStaticIdx)
expect(generatingStaticIdx).toBeLessThan(finalizingOptimization)
} finally {
await fs.remove(appDir)
}
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment