Skip to content

Commit 7ce6d23

Browse files
committed
test: add test for importing acorn
PR-URL: #15566 Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent e38570f commit 7ce6d23

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/parallel/test-require-deps-deprecation.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict';
22

33
const common = require('../common');
4+
const assert = require('assert');
45
// The v8 modules when imported leak globals. Disable global check.
56
common.globalCheck = false;
67

@@ -20,6 +21,13 @@ const deprecatedModules = [
2021
'v8/tools/tickprocessor-driver'
2122
];
2223

24+
// Newly added deps that do not have a deprecation wrapper around it would
25+
// throw an error, but no warning would be emitted.
26+
const deps = [
27+
'acorn/dist/acorn',
28+
'acorn/dist/walk'
29+
];
30+
2331
common.expectWarning('DeprecationWarning', deprecatedModules.map((m) => {
2432
return `Requiring Node.js-bundled '${m}' module is deprecated. ` +
2533
'Please install the necessary module locally.';
@@ -30,3 +38,7 @@ for (const m of deprecatedModules) {
3038
require(m);
3139
} catch (err) {}
3240
}
41+
42+
for (const m of deps) {
43+
assert.throws(() => { require(m); }, /^Error: Cannot find module/);
44+
}

0 commit comments

Comments
 (0)