Skip to content

Commit f6526f7

Browse files
committed
test: use common.expectWarning()
Signed-off-by: Darshan Sen <raisinten@gmail.com>
1 parent b814716 commit f6526f7

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

test/parallel/test-vfs.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const common = require('../common');
66
const Module = require('module');
77
const fs = require('fs');
88
const tmpdir = require('../common/tmpdir');
9-
const { deepStrictEqual, match, ok, strictEqual, throws } = require('assert');
9+
const { deepStrictEqual, ok, strictEqual, throws } = require('assert');
1010
const { join } = require('path');
1111

1212
const directory = join(tmpdir.path, 'directory');
@@ -32,9 +32,11 @@ ok(Module._stat(vfsFile) < 0);
3232
deepStrictEqual(require(file), { a: 'b' });
3333
throws(() => require(vfsFile), { code: 'MODULE_NOT_FOUND' });
3434

35-
process.on('warning', common.mustCall((warning) => {
36-
match(warning.message, /is an experimental feature/);
37-
}, 1));
35+
common.expectWarning(
36+
'ExperimentalWarning',
37+
'Module._stat is an experimental feature. This feature could change at any time');
38+
39+
process.on('warning', common.mustCall());
3840

3941
const originalStat = Module._stat;
4042
Module._stat = function(filename) {

0 commit comments

Comments
 (0)