Unverified Commit 596ee9c1 authored by James George's avatar James George Committed by GitHub

tests(create-next-app): remove extraneous helper (#18833)

The helper `runStarter()` is extraneous.
parent f78ee06f
...@@ -12,19 +12,6 @@ const run = (cwd, args, input) => { ...@@ -12,19 +12,6 @@ const run = (cwd, args, input) => {
const options = input ? { cwd, input } : { cwd } const options = input ? { cwd, input } : { cwd }
return execa('node', [cli].concat(args), options) return execa('node', [cli].concat(args), options)
} }
const runStarter = (cwd, ...args) => {
const res = run(cwd, args)
res.stdout.on('data', (data) => {
const stdout = data.toString()
if (/Pick a template/.test(stdout)) {
res.stdin.write('\n')
}
})
return res
}
async function usingTempDir(fn, options) { async function usingTempDir(fn, options) {
const folder = path.join(os.tmpdir(), Math.random().toString(36).substring(2)) const folder = path.join(os.tmpdir(), Math.random().toString(36).substring(2))
...@@ -46,7 +33,7 @@ describe('create next app', () => { ...@@ -46,7 +33,7 @@ describe('create next app', () => {
expect.assertions(1) expect.assertions(1)
try { try {
await runStarter(cwd, projectName) await run(cwd, [projectName])
} catch (e) { } catch (e) {
// eslint-disable-next-line jest/no-try-expect // eslint-disable-next-line jest/no-try-expect
expect(e.stdout).toMatch(/contains files that could conflict/) expect(e.stdout).toMatch(/contains files that could conflict/)
...@@ -60,7 +47,7 @@ describe('create next app', () => { ...@@ -60,7 +47,7 @@ describe('create next app', () => {
it('empty directory', async () => { it('empty directory', async () => {
await usingTempDir(async (cwd) => { await usingTempDir(async (cwd) => {
const projectName = 'empty-directory' const projectName = 'empty-directory'
const res = await runStarter(cwd, projectName) const res = await run(cwd, [projectName])
expect(res.exitCode).toBe(0) expect(res.exitCode).toBe(0)
expect( expect(
...@@ -257,7 +244,7 @@ describe('create next app', () => { ...@@ -257,7 +244,7 @@ describe('create next app', () => {
const projectName = 'not-writable' const projectName = 'not-writable'
expect.assertions(2) expect.assertions(2)
try { try {
const res = await runStarter(cwd, projectName) const res = await run(cwd, [projectName])
if (process.platform === 'win32') { if (process.platform === 'win32') {
expect(res.exitCode).toBe(0) expect(res.exitCode).toBe(0)
......
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