0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/async-hooks/test-fseventwrap.js
Rich Trott 275d0b30a0 test: accommodate AIX by watching file
Watching directories has limited support on AIX. This is documented.
Watch a file in test/async-hooks/test-fseventwrap.js to accommodate AIX.

PR-URL: https://github.com/nodejs/node/pull/13766
Ref: https://github.com/nodejs/node/issues/13577#issuecomment-308038674
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-06-20 07:47:46 -07:00

34 lines
808 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const initHooks = require('./init-hooks');
const tick = require('./tick');
const { checkInvocations } = require('./hook-checks');
const fs = require('fs');
const hooks = initHooks();
hooks.enable();
const watcher = fs.watch(__filename, onwatcherChanged);
function onwatcherChanged() { }
watcher.close();
tick(2);
process.on('exit', onexit);
function onexit() {
hooks.disable();
hooks.sanityCheck('FSEVENTWRAP');
const as = hooks.activitiesOfTypes('FSEVENTWRAP');
assert.strictEqual(as.length, 1);
const a = as[0];
assert.strictEqual(a.type, 'FSEVENTWRAP');
assert.strictEqual(typeof a.uid, 'number');
assert.strictEqual(a.triggerAsyncId, 1);
checkInvocations(a, { init: 1, destroy: 1 }, 'when process exits');
}