Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
test(create-next-app): assert for typescript template dependencies (v…
Browse files Browse the repository at this point in the history
…ercel#25214)

This PR aims at updating the `create-next-app` test suite to include an assertion for the dependencies specific to the typescript template.
https://github.com/vercel/next.js/blob/218c6114c9f5ed5c6d65840037673c841f44536b/packages/create-next-app/create-app.ts#L214-L216
  • Loading branch information
jamesgeorge007 authored May 19, 2021
1 parent 0f35810 commit 5869d06
Showing 1 changed file with 15 additions and 3 deletions.
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

0 comments on commit 5869d06

Please sign in to comment.