Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: move timer-dependent test to sequential #9487

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions test/parallel/test-regress-GH-897.js

This file was deleted.

17 changes: 17 additions & 0 deletions test/sequential/test-regress-GH-897.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict';

// Test for bug where a timer duration greater than 0 ms but less than 1 ms
// resulted in the duration being set for 1000 ms. The expected behavior is
// that the timeout would be set for 1 ms, and thus fire more-or-less
// immediately.
//
// Ref: https://github.com/nodejs/node-v0.x-archive/pull/897

require('../common');
const assert = require('assert');

const t = Date.now();
setTimeout(function() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you dropped the process.on('exit', ...), this should probably use common.mustCall().

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Done.

const diff = Date.now() - t;
assert.ok(diff < 100, `timer fired after ${diff} ms`);
}, 0.1);