Unverified Commit 4b8e5396 authored by James George's avatar James George Committed by GitHub

test(create-next-app): use latest examples (#24048)

Update CNA test suite to consume [vercel-learn-starter](https://github.com/vercel/next-learn-starter) as the example repo.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.

## Documentation / Examples

- [ ] Make sure the linting passes
parent b7a12655
...@@ -6,6 +6,9 @@ import path from 'path' ...@@ -6,6 +6,9 @@ import path from 'path'
const cli = require.resolve('create-next-app/dist/index.js') const cli = require.resolve('create-next-app/dist/index.js')
const exampleRepo = 'https://github.com/vercel/next-learn-starter/tree/master'
const examplePath = 'navigate-between-pages-starter'
jest.setTimeout(1000 * 60 * 5) jest.setTimeout(1000 * 60 * 5)
const run = (args, options) => execa('node', [cli].concat(args), options) const run = (args, options) => execa('node', [cli].concat(args), options)
...@@ -92,11 +95,7 @@ describe('create next app', () => { ...@@ -92,11 +95,7 @@ describe('create next app', () => {
await usingTempDir(async (cwd) => { await usingTempDir(async (cwd) => {
const projectName = 'github-app' const projectName = 'github-app'
const res = await run( const res = await run(
[ [projectName, '--example', `${exampleRepo}/${examplePath}`],
projectName,
'--example',
'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages',
],
{ {
cwd, cwd,
} }
...@@ -109,9 +108,6 @@ describe('create next app', () => { ...@@ -109,9 +108,6 @@ describe('create next app', () => {
expect( expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.js')) fs.existsSync(path.join(cwd, projectName, 'pages/index.js'))
).toBeTruthy() ).toBeTruthy()
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/about.js'))
).toBeTruthy()
expect( expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore')) fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy() ).toBeTruthy()
...@@ -122,13 +118,7 @@ describe('create next app', () => { ...@@ -122,13 +118,7 @@ describe('create next app', () => {
await usingTempDir(async (cwd) => { await usingTempDir(async (cwd) => {
const projectName = 'github-example-path' const projectName = 'github-example-path'
const res = await run( const res = await run(
[ [projectName, '--example', exampleRepo, '--example-path', examplePath],
projectName,
'--example',
'https://github.com/zeit/next-learn-demo/tree/master',
'--example-path',
'1-navigate-between-pages',
],
{ {
cwd, cwd,
} }
...@@ -141,9 +131,6 @@ describe('create next app', () => { ...@@ -141,9 +131,6 @@ describe('create next app', () => {
expect( expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.js')) fs.existsSync(path.join(cwd, projectName, 'pages/index.js'))
).toBeTruthy() ).toBeTruthy()
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/about.js'))
).toBeTruthy()
expect( expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore')) fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy() ).toBeTruthy()
...@@ -157,9 +144,9 @@ describe('create next app', () => { ...@@ -157,9 +144,9 @@ describe('create next app', () => {
[ [
projectName, projectName,
'--example', '--example',
'https://github.com/zeit/next-learn-demo/tree/master/1-navigate-between-pages', `${exampleRepo}/${examplePath}`,
'--example-path', '--example-path',
'1-navigate-between-pages', examplePath,
], ],
{ {
cwd, cwd,
...@@ -173,9 +160,6 @@ describe('create next app', () => { ...@@ -173,9 +160,6 @@ describe('create next app', () => {
expect( expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.js')) fs.existsSync(path.join(cwd, projectName, 'pages/index.js'))
).toBeTruthy() ).toBeTruthy()
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/about.js'))
).toBeTruthy()
expect( expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore')) fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy() ).toBeTruthy()
......
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