Unverified Commit 83a09eee authored by James George's avatar James George Committed by GitHub

test(create-next-app): assert for typescript template dependencies (#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
parent 25096df8
...@@ -97,9 +97,9 @@ describe('create next app', () => { ...@@ -97,9 +97,9 @@ describe('create next app', () => {
const res = await run([projectName, '--typescript'], { cwd }) const res = await run([projectName, '--typescript'], { cwd })
expect(res.exitCode).toBe(0) expect(res.exitCode).toBe(0)
expect( const pkgJSONPath = path.join(cwd, projectName, 'package.json')
fs.existsSync(path.join(cwd, projectName, 'package.json'))
).toBeTruthy() expect(fs.existsSync(pkgJSONPath)).toBeTruthy()
expect( expect(
fs.existsSync(path.join(cwd, projectName, 'pages/index.tsx')) fs.existsSync(path.join(cwd, projectName, 'pages/index.tsx'))
).toBeTruthy() ).toBeTruthy()
...@@ -119,6 +119,18 @@ describe('create next app', () => { ...@@ -119,6 +119,18 @@ describe('create next app', () => {
expect( expect(
fs.existsSync(path.join(cwd, projectName, '.gitignore')) fs.existsSync(path.join(cwd, projectName, '.gitignore'))
).toBeTruthy() ).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',
])
}) })
}) })
......
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