Skip to content

Commit

Permalink
fail tests if the first testAllocate fails
Browse files Browse the repository at this point in the history
Otherwise we abruptly stop with a panic.
  • Loading branch information
mvdan committed Nov 27, 2019
1 parent aabea60 commit d883c83
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chromedp_test.go
Expand Up @@ -96,6 +96,11 @@ func testAllocate(tb testing.TB, name string) (context.Context, context.CancelFu
// Start the browser exactly once, as needed.
allocateOnce.Do(func() { browserCtx, _ = testAllocateSeparate(tb) })

if browserCtx == nil {
// allocateOnce.Do failed; continuing would result in panics.
tb.FailNow()
}

// Same browser, new tab; not needing to start new chrome browsers for
// each test gives a huge speed-up.
ctx, _ := NewContext(browserCtx)
Expand Down

0 comments on commit d883c83

Please sign in to comment.