Files
codeql/javascript/ql/test/query-tests/NodeJS/UnresolvableImport/src/tst.js
Asger F 70a5ec5607 JS: Add package.json files in tests relying on node_modules
We don't extract node_modules folders by default so these tests aren't
that relevant anymore, and we no longer follow node_modules resolution
rules directly.

Instead, these imports are resolved based on the monorepo support which
simply requires a package.json file to exist. There is not a good enough
reason to support node_modules directly, so we're accepting some
minor regression in these tests.
2025-04-29 16:06:38 +02:00

12 lines
660 B
JavaScript

require('fs'); // OK - there is an externs file for it
require('other'); // $ Alert - there is an externs file, but it is not a Node.js module
require('foo'); // OK - declared as a dependency
require('bar/sub'); // OK - 'bar' declared as a dependency
require('./local'); // OK - local import
require('/global'); // OK - global import
require('mod'); // $ MISSING: Alert // this is resolved due to the package.json file named "mod", but Node.js would not find it
require('undeclared'); // $ Alert
require('jade!./template.jade'); // OK - WebPack loader
require('imports?$=jquery!./m.js'); // OK - WebPack shim
require('react'); // OK - peer dependency