Skip to content

Commit

Permalink
remove needles function
Browse files Browse the repository at this point in the history
  • Loading branch information
jankaifer committed Feb 27, 2023
1 parent bad9f53 commit e2f938d
Showing 1 changed file with 29 additions and 33 deletions.
62 changes: 29 additions & 33 deletions test/examples/examples.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,38 +72,34 @@ const testedExamples = [
'with-vercel-fetch',
]

const testExamples = (examples) => {
describe.each(examples)(`example '%s'`, (example) => {
// If there is an issue during a build, jest won't tell us which example caused it
// we need to log it ourselfs
beforeAll(() => {
require('console').log(`Running example '${example}'`)
})

const exampleFiles = path.join(__dirname, '..', '..', 'examples', example)
const packageJson = fs.readJsonSync(path.join(exampleFiles, 'package.json'))
createNextDescribe(
`example '${example}'`,
{
files: exampleFiles,
dependencies: {
// We need to make sure that these default dependencies are not installed by default
// for our examples to ensure that they have all their dependencies in package.json
'@types/node': undefined,
'@types/react': undefined,
next: undefined,
react: undefined,
'react-dom': undefined,
typescript: undefined,
...packageJson.dependencies,
...packageJson.devDependencies,
},
},
() => {
it('builds', () => {})
}
)
describe.each(testedExamples)(`example '%s'`, (example) => {
// If there is an issue during a build, jest won't tell us which example caused it
// we need to log it ourselfs
beforeAll(() => {
require('console').log(`Running example '${example}'`)
})
}

testExamples(testedExamples)
const exampleFiles = path.join(__dirname, '..', '..', 'examples', example)
const packageJson = fs.readJsonSync(path.join(exampleFiles, 'package.json'))
createNextDescribe(
`example '${example}'`,
{
files: exampleFiles,
dependencies: {
// We need to make sure that these default dependencies are not installed by default
// for our examples to ensure that they have all their dependencies in package.json
'@types/node': undefined,
'@types/react': undefined,
next: undefined,
react: undefined,
'react-dom': undefined,
typescript: undefined,
...packageJson.dependencies,
...packageJson.devDependencies,
},
},
() => {
it('builds', () => {})
}
)
})

0 comments on commit e2f938d

Please sign in to comment.