Unverified Commit 295f15e0 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix test retry cleanup (#43011)

As noticed in
https://github.com/vercel/next.js/pull/42966#pullrequestreview-1181705091
we weren't resetting tests correctly on retry causing an incorrect pass.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see `contributing.md`

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see `contributing.md`

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
parent 71a8c73d
...@@ -356,7 +356,13 @@ async function main() { ...@@ -356,7 +356,13 @@ async function main() {
} catch (err) { } catch (err) {
if (i < numRetries) { if (i < numRetries) {
try { try {
const testDir = path.dirname(path.join(__dirname, test)) let testDir = path.dirname(path.join(__dirname, test))
// if test is nested in a test folder traverse up a dir to ensure
// we clean up relevant test files
if (testDir.endsWith('/test') || testDir.endsWith('\\test')) {
testDir = path.join(testDir, '../')
}
console.log('Cleaning test files at', testDir) console.log('Cleaning test files at', testDir)
await exec(`git clean -fdx "${testDir}"`) await exec(`git clean -fdx "${testDir}"`)
await exec(`git checkout "${testDir}"`) await exec(`git checkout "${testDir}"`)
......
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