Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(create-next-app): assert for typescript template dependencies #25214

Merged
merged 1 commit into from
May 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions test/integration/create-next-app/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ describe('create next app', () => {
const res = await run([projectName, '--typescript'], { cwd })
expect(res.exitCode).toBe(0)

expect(
fs.existsSync(path.join(cwd, projectName, 'package.json'))
).toBeTruthy()
const pkgJSONPath = path.join(cwd, projectName, 'package.json')

expect(fs.existsSync(pkgJSONPath)).toBeTruthy()
expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.tsx'))
).toBeTruthy()
Expand All @@ -119,6 +119,18 @@ describe('create next app', () => {
expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy()

// Assert for dependencies specific to the typescript template
const pkgJSON = require(pkgJSONPath)
expect(Object.keys(pkgJSON.dependencies)).toEqual([
'next',
'react',
'react-dom',
])
expect(Object.keys(pkgJSON.devDependencies)).toEqual([
'@types/react',
'typescript',
])
})
})

Expand Down