Skip to content

Commit

Permalink
Merge pull request #2 from andersk/redos-specs-timeout
Browse files Browse the repository at this point in the history
redos specs: Add 1s timeout check
  • Loading branch information
UziTech committed Apr 4, 2019
2 parents 27a3f7b + 416dd69 commit bcb51f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/specs/redos-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ describe('ReDOS tests', () => {

it(file, () => {
const spec = require(path.resolve(__dirname, '../redos', file));
const before = process.hrtime();
expect(spec).toRender(spec.html);
const elapsed = process.hrtime(before);
if (elapsed[0] > 0) {
const s = (elapsed[0] + elapsed[1] * 1e-9).toFixed(3);
fail(`took too long: ${s}s`);
}
});
});
});

0 comments on commit bcb51f9

Please sign in to comment.