0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/async-hooks/test-graph.statwatcher.js
Ruben Bridgewater b08a867d60
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
2019-03-27 17:20:06 +01:00

35 lines
773 B
JavaScript

'use strict';
require('../common');
const commonPath = require.resolve('../common');
const initHooks = require('./init-hooks');
const verifyGraph = require('./verify-graph');
const fs = require('fs');
const hooks = initHooks();
hooks.enable();
function onchange() { }
// Install first file watcher
fs.watchFile(__filename, onchange);
// Install second file watcher
fs.watchFile(commonPath, onchange);
// Remove first file watcher
fs.unwatchFile(__filename);
// Remove second file watcher
fs.unwatchFile(commonPath);
process.on('exit', onexit);
function onexit() {
hooks.disable();
verifyGraph(
hooks,
[ { type: 'STATWATCHER', id: 'statwatcher:1', triggerAsyncId: null },
{ type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ]
);
}