1 | 'use strict';
|
2 | var test = require('tap').test;
|
3 |
|
4 | if (!process.addAsyncListener) {
|
5 | test("overwriting startup.processNextTick", function (t) {
|
6 | t.plan(2);
|
7 |
|
8 | t.doesNotThrow(function () { require('../context.js'); });
|
9 |
|
10 | t.ok(process.nextTick.__wrapped, "should wrap process.nextTick()");
|
11 | });
|
12 |
|
13 | test("overwriting domain helpers", function (t) {
|
14 |
|
15 | if (!(process._nextDomainTick ||
|
16 | process._tickDomainCallback)) {
|
17 | return t.end();
|
18 | }
|
19 |
|
20 | t.plan(2);
|
21 |
|
22 | t.ok(process._nextDomainTick.__wrapped,
|
23 | "should wrap process._nextDomainTick()");
|
24 | t.ok(process._tickDomainCallback.__wrapped,
|
25 | "should wrap process._tickDomainCallback()");
|
26 | });
|
27 |
|
28 | test("overwriting timers", function (t) {
|
29 | t.plan(2);
|
30 |
|
31 | var timers = require('timers');
|
32 | t.ok(timers.setTimeout.__wrapped, "should wrap setTimeout()");
|
33 | t.ok(timers.setInterval.__wrapped, "should wrap setInterval()");
|
34 |
|
35 | |
36 |
|
37 |
|
38 |
|
39 |
|
40 | });
|
41 |
|
42 | test("overwriting setImmediate", function (t) {
|
43 |
|
44 | if (!global.setImmediate) return t.end();
|
45 |
|
46 | t.plan(1);
|
47 |
|
48 | t.ok(require('timers').setImmediate.__wrapped, "should wrap setImmediate()");
|
49 |
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 | });
|
56 | }
|