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 @@ ...@@ -169,7 +169,6 @@
"nanoid": "3.1.30", "nanoid": "3.1.30",
"next": "workspace:*", "next": "workspace:*",
"node-fetch": "2.6.7", "node-fetch": "2.6.7",
"node-pty": "0.10.1",
"npm-run-all": "4.1.5", "npm-run-all": "4.1.5",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"open": "9.0.0", "open": "9.0.0",
......
...@@ -127,7 +127,6 @@ importers: ...@@ -127,7 +127,6 @@ importers:
nanoid: 3.1.30 nanoid: 3.1.30
next: workspace:* next: workspace:*
node-fetch: 2.6.7 node-fetch: 2.6.7
node-pty: 0.10.1
npm-run-all: 4.1.5 npm-run-all: 4.1.5
nprogress: 0.2.0 nprogress: 0.2.0
open: 9.0.0 open: 9.0.0
...@@ -299,7 +298,6 @@ importers: ...@@ -299,7 +298,6 @@ importers:
nanoid: 3.1.30 nanoid: 3.1.30
next: link:packages/next next: link:packages/next
node-fetch: 2.6.7 node-fetch: 2.6.7
node-pty: 0.10.1
npm-run-all: 4.1.5 npm-run-all: 4.1.5
nprogress: 0.2.0 nprogress: 0.2.0
open: 9.0.0 open: 9.0.0
...@@ -6162,7 +6160,7 @@ packages: ...@@ -6162,7 +6160,7 @@ packages:
dependencies: dependencies:
'@mdx-js/mdx': 2.2.1 '@mdx-js/mdx': 2.2.1
source-map: 0.7.3 source-map: 0.7.3
webpack: 5.86.0 webpack: 5.86.0_@swc+core@1.3.55
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
...@@ -6908,7 +6906,6 @@ packages: ...@@ -6908,7 +6906,6 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-darwin-x64/1.3.55: /@swc/core-darwin-x64/1.3.55:
...@@ -6917,7 +6914,6 @@ packages: ...@@ -6917,7 +6914,6 @@ packages:
cpu: [x64] cpu: [x64]
os: [darwin] os: [darwin]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm-gnueabihf/1.3.55: /@swc/core-linux-arm-gnueabihf/1.3.55:
...@@ -6926,7 +6922,6 @@ packages: ...@@ -6926,7 +6922,6 @@ packages:
cpu: [arm] cpu: [arm]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm64-gnu/1.3.55: /@swc/core-linux-arm64-gnu/1.3.55:
...@@ -6935,7 +6930,6 @@ packages: ...@@ -6935,7 +6930,6 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-arm64-musl/1.3.55: /@swc/core-linux-arm64-musl/1.3.55:
...@@ -6944,7 +6938,6 @@ packages: ...@@ -6944,7 +6938,6 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-x64-gnu/1.3.55: /@swc/core-linux-x64-gnu/1.3.55:
...@@ -6953,7 +6946,6 @@ packages: ...@@ -6953,7 +6946,6 @@ packages:
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-linux-x64-musl/1.3.55: /@swc/core-linux-x64-musl/1.3.55:
...@@ -6962,7 +6954,6 @@ packages: ...@@ -6962,7 +6954,6 @@ packages:
cpu: [x64] cpu: [x64]
os: [linux] os: [linux]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-arm64-msvc/1.3.55: /@swc/core-win32-arm64-msvc/1.3.55:
...@@ -6971,7 +6962,6 @@ packages: ...@@ -6971,7 +6962,6 @@ packages:
cpu: [arm64] cpu: [arm64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-ia32-msvc/1.3.55: /@swc/core-win32-ia32-msvc/1.3.55:
...@@ -6980,7 +6970,6 @@ packages: ...@@ -6980,7 +6970,6 @@ packages:
cpu: [ia32] cpu: [ia32]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core-win32-x64-msvc/1.3.55: /@swc/core-win32-x64-msvc/1.3.55:
...@@ -6989,7 +6978,6 @@ packages: ...@@ -6989,7 +6978,6 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
requiresBuild: true requiresBuild: true
dev: true
optional: true optional: true
/@swc/core/1.3.55_@swc+helpers@0.5.1: /@swc/core/1.3.55_@swc+helpers@0.5.1:
...@@ -7014,7 +7002,6 @@ packages: ...@@ -7014,7 +7002,6 @@ packages:
'@swc/core-win32-arm64-msvc': 1.3.55 '@swc/core-win32-arm64-msvc': 1.3.55
'@swc/core-win32-ia32-msvc': 1.3.55 '@swc/core-win32-ia32-msvc': 1.3.55
'@swc/core-win32-x64-msvc': 1.3.55 '@swc/core-win32-x64-msvc': 1.3.55
dev: true
/@swc/helpers/0.4.14: /@swc/helpers/0.4.14:
resolution: {integrity: sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==} resolution: {integrity: sha512-4C7nX/dvpzB7za4Ql9K81xK3HPxCpHMgwTZVyf+9JQ6VUbn9jjZVN7/Nkdz/Ugzs2CSjqnL/UPXroiVBVHUWUw==}
...@@ -18168,11 +18155,6 @@ packages: ...@@ -18168,11 +18155,6 @@ packages:
/mute-stream/0.0.8: /mute-stream/0.0.8:
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
/nan/2.15.0:
resolution: {integrity: sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==}
requiresBuild: true
dev: true
/nanoid/3.1.30: /nanoid/3.1.30:
resolution: {integrity: sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==} resolution: {integrity: sha512-zJpuPDwOv8D2zq2WRoMe1HsfZthVewpel9CAvTfc/2mBD1uUT/agc5f7GHGWXlYkFvi1mVxe4IjvP2HNrop7nQ==}
engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
...@@ -18446,13 +18428,6 @@ packages: ...@@ -18446,13 +18428,6 @@ packages:
upper-case: 2.0.2 upper-case: 2.0.2
dev: true 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: /node-releases/2.0.3:
resolution: {integrity: sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==} resolution: {integrity: sha512-maHFz6OLqYxz+VQyCAtA3PTX4UP/53pa05fyDNc9CwjvJ0yEh6+xBwKsgCxMNhS8taUKBFYxfuiaD9U/55iFaw==}
...@@ -23915,7 +23890,6 @@ packages: ...@@ -23915,7 +23890,6 @@ packages:
serialize-javascript: 6.0.1 serialize-javascript: 6.0.1
terser: 5.17.7 terser: 5.17.7
webpack: 5.86.0_@swc+core@1.3.55 webpack: 5.86.0_@swc+core@1.3.55
dev: true
/terser/5.10.0: /terser/5.10.0:
resolution: {integrity: sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==} resolution: {integrity: sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==}
...@@ -25287,7 +25261,6 @@ packages: ...@@ -25287,7 +25261,6 @@ packages:
- '@swc/core' - '@swc/core'
- esbuild - esbuild
- uglify-js - uglify-js
dev: true
/websocket-driver/0.7.3: /websocket-driver/0.7.3:
resolution: {integrity: sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==} resolution: {integrity: sha512-bpxWlvbbB459Mlipc5GBzzZwhoZgGEZLuqPaR0INBGnPAY1vdBX6hPnoFXiw+3yWxDuHyQjO2oXTMyS8A5haFg==}
......
import * as pty from 'node-pty'
import fs from 'fs-extra'
import path from 'path' import path from 'path'
import fs from 'fs-extra'
import stripAnsi from 'strip-ansi' import stripAnsi from 'strip-ansi'
import resolveFrom from 'resolve-from'
import { NextInstance, createNext } from 'e2e-utils'
type File = { type File = {
filename: string filename: string
...@@ -44,7 +45,27 @@ const pagesFiles: File[] = [ ...@@ -44,7 +45,27 @@ const pagesFiles: File[] = [
}, },
] ]
it.each([ 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', files: appDirFiles },
{ {
name: 'app dir (compile workers)', name: 'app dir (compile workers)',
...@@ -80,18 +101,17 @@ it.each([ ...@@ -80,18 +101,17 @@ it.each([
}, },
{ name: 'page dir (compile workers)', files: pagesFiles }, { name: 'page dir (compile workers)', files: pagesFiles },
{ name: 'app and pages', files: [...appDirFiles, ...pagesFiles] }, { name: 'app and pages', files: [...appDirFiles, ...pagesFiles] },
])('should handle build spinners correctly $name', async ({ files }) => { ])('should handle build spinners correctly $name', async ({ files }) => {
const appDir = path.join(__dirname, 'app') for (const { filename, content } of files) {
await fs.remove(appDir) await next.patchFile(filename, content)
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)
} }
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 output = []
const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], { const ptyProcess = pty.spawn(process.execPath, [nextBin, 'build'], {
name: 'xterm-color', name: 'xterm-color',
...@@ -170,7 +190,5 @@ it.each([ ...@@ -170,7 +190,5 @@ it.each([
expect(compiledIdx).toBeLessThan(collectingPageDataIdx) expect(compiledIdx).toBeLessThan(collectingPageDataIdx)
expect(collectingPageDataIdx).toBeLessThan(generatingStaticIdx) expect(collectingPageDataIdx).toBeLessThan(generatingStaticIdx)
expect(generatingStaticIdx).toBeLessThan(finalizingOptimization) 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