Skip to content

Commit

Permalink
tests: fix flaky cache test (#12606)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark committed Jun 2, 2021
1 parent a938fc4 commit 7a4a317
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,18 @@ function networkRecord(options = {}) {
}

describe('Cache headers audit', () => {
// Stub Date.now so the tests are not sensitive to timing.
let dateNowFn;
beforeAll(() => {
dateNowFn = Date.now;
const now = Date.now();
Date.now = () => now;
});

afterAll(() => {
Date.now = dateNowFn;
});

function getArtifacts(networkRecords) {
const devtoolLogs = networkRecordsToDevtoolsLog(networkRecords);

Expand Down

0 comments on commit 7a4a317

Please sign in to comment.