| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d89f310 commit b5752ee
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,28 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + const assert = require('assert'); | ||
| 5 | + // The v8 modules when imported leak globals. Disable global check. | ||
| 6 | + common.globalCheck = false; | ||
| 7 | + | ||
| 8 | + // Newly added deps that do not have a deprecation wrapper around it would | ||
| 9 | + // throw an error, but no warning would be emitted. | ||
| 10 | + const deps = [ | ||
| 11 | + 'acorn/dist/acorn', | ||
| 12 | + 'acorn/dist/walk' | ||
| 13 | + ]; | ||
| 14 | + | ||
| 15 | + // Instead of checking require, check that resolve isn't pointing toward a | ||
| 16 | + // built-in module, as user might already have node installed with acorn in | ||
| 17 | + // require.resolve range. | ||
| 18 | + // Ref: https://github.com/nodejs/node/issues/17148 | ||
| 19 | + for (const m of deps) { | ||
| 20 | + let path; | ||
| 21 | + try { | ||
| 22 | + path = require.resolve(m); | ||
| 23 | + } catch (err) { | ||
| 24 | + assert.ok(err.toString().startsWith('Error: Cannot find module ')); | ||
| 25 | + continue; | ||
| 26 | + } | ||
| 27 | + assert.notStrictEqual(path, m); | ||
| 28 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments