Skip to content

Commit

Permalink
test: add time check
Browse files Browse the repository at this point in the history
Fail tests that take more than 1 second
  • Loading branch information
davisjam committed Feb 26, 2018
1 parent 007f60b commit 66bc339
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/index.js
Expand Up @@ -110,8 +110,13 @@ function runTests(engine, options) {
for (i = 0; i < len; i++) {
filename = filenames[i];
file = files[filename];

var before = process.hrtime();
success = testFile(engine, file, filename, i + 1);
if (success) {
var elapsed = process.hrtime(before);
var tookLessThanOneSec = (elapsed[0] === 0);

if (success && tookLessThanOneSec) {
succeeded++;
} else {
failed++;
Expand Down

0 comments on commit 66bc339

Please sign in to comment.