Skip to content

Commit

Permalink
Fix test retry cleanup (#43011)
Browse files Browse the repository at this point in the history
As noticed in
#42966 (review)
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)
  • Loading branch information
ijjk committed Nov 16, 2022
1 parent 71a8c73 commit 295f15e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion run-tests.js
Expand Up @@ -356,7 +356,13 @@ async function main() {
} catch (err) {
if (i < numRetries) {
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)
await exec(`git clean -fdx "${testDir}"`)
await exec(`git checkout "${testDir}"`)
Expand Down

0 comments on commit 295f15e

Please sign in to comment.