Skip to content

Commit

Permalink
test: add test for importing acorn
Browse files Browse the repository at this point in the history
PR-URL: nodejs#15566
Reviewed-By: Stephen Belanger <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
  • Loading branch information
TimothyGu committed Nov 16, 2017
1 parent e38570f commit 7ce6d23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/parallel/test-require-deps-deprecation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const common = require('../common');
const assert = require('assert');
// The v8 modules when imported leak globals. Disable global check.
common.globalCheck = false;

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

// Newly added deps that do not have a deprecation wrapper around it would
// throw an error, but no warning would be emitted.
const deps = [
'acorn/dist/acorn',
'acorn/dist/walk'
];

common.expectWarning('DeprecationWarning', deprecatedModules.map((m) => {
return `Requiring Node.js-bundled '${m}' module is deprecated. ` +
'Please install the necessary module locally.';
Expand All @@ -30,3 +38,7 @@ for (const m of deprecatedModules) {
require(m);
} catch (err) {}
}

for (const m of deps) {
assert.throws(() => { require(m); }, /^Error: Cannot find module/);
}

0 comments on commit 7ce6d23

Please sign in to comment.