Skip to content

Commit

Permalink
test(create-next-app): assert for typescript template dependencies (#…
Browse files Browse the repository at this point in the history
…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 25096df commit 83a09ee
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 83a09ee

Please sign in to comment.