• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3require('../common');
4const commonPath = require.resolve('../common');
5const initHooks = require('./init-hooks');
6const verifyGraph = require('./verify-graph');
7const fs = require('fs');
8
9const hooks = initHooks();
10hooks.enable();
11
12function onchange() { }
13// Install first file watcher
14fs.watchFile(__filename, onchange);
15
16// Install second file watcher
17fs.watchFile(commonPath, onchange);
18
19// Remove first file watcher
20fs.unwatchFile(__filename);
21
22// Remove second file watcher
23fs.unwatchFile(commonPath);
24
25process.on('exit', onexit);
26
27function onexit() {
28  hooks.disable();
29  verifyGraph(
30    hooks,
31    [ { type: 'STATWATCHER', id: 'statwatcher:1', triggerAsyncId: null },
32      { type: 'STATWATCHER', id: 'statwatcher:2', triggerAsyncId: null } ],
33  );
34}
35