Skip to content

Commit

Permalink
adjust cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ijjk committed Sep 30, 2024
1 parent db2f5ee commit 58a9d9d
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions test/integration/eslint/test/next-lint.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,33 +32,38 @@ describe('Next Lint', () => {
// installing can take time so increase default time outs
jest.setTimeout(120 * 1000)

const folders = []
afterAll(async () => {
for (const folder of folders) {
await fs.remove(folder)
}
})

describe('First Time Setup ', () => {
async function nextLintTemp(setupCallback, isApp = false) {
const folder = join(os.tmpdir(), Math.random().toString(36).substring(2))
folders.push(folder)

await fs.mkdirp(folder)
await fs.copy(join(dirNoConfig, isApp ? 'app' : ''), folder)
await setupCallback?.(folder)

try {
const { stdout, stderr } = await nextLint(folder, ['--strict'], {
stderr: true,
stdout: true,
cwd: folder,
})
const { stdout, stderr } = await nextLint(folder, ['--strict'], {
stderr: true,
stdout: true,
cwd: folder,
})

console.log({ stdout, stderr })
console.log({ stdout, stderr })

const pkgJson = JSON.parse(
await fs.readFile(join(folder, 'package.json'), 'utf8')
)
const eslintrcJson = JSON.parse(
await fs.readFile(join(folder, '.eslintrc.json'), 'utf8')
)
const pkgJson = JSON.parse(
await fs.readFile(join(folder, 'package.json'), 'utf8')
)
const eslintrcJson = JSON.parse(
await fs.readFile(join(folder, '.eslintrc.json'), 'utf8')
)

return { stdout, pkgJson, eslintrcJson }
} finally {
await fs.remove(folder)
}
return { stdout, pkgJson, eslintrcJson }
}

test('show a prompt to set up ESLint if no configuration detected', async () => {
Expand Down

0 comments on commit 58a9d9d

Please sign in to comment.