fix(45927): fix missing path for Module in v12 (#45940)

* fix(45927): fix missing `path` for Module in v12

This is an attempt to fix a problem reported in #45927

/cc @tk-1io

Thanks!

Fixes #45927

* Update types/node/v12/node-tests.ts

thx to @Exe-Boss

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>

Co-authored-by: ExE Boss <3889017+ExE-Boss@users.noreply.github.com>
This commit is contained in:
Piotr Błażejewicz (Peter Blazejewicz) 2020-07-10 17:40:02 +02:00 committed by GitHub
parent 28a932ba83
commit 181b253d3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -1162,6 +1162,12 @@ declare namespace NodeJS {
loaded: boolean;
parent: Module | null;
children: Module[];
/**
* @since 11.14.0
*
* The directory name of the module. This is usually the same as the path.dirname() of the module.id.
*/
path: string;
paths: string[];
constructor(id: string, parent?: Module);

View File

@ -764,6 +764,7 @@ import moduleModule = require('module');
const m2: Module = new Module.Module("moduleId");
const b: string[] = Module.builtinModules;
let paths: string[] = module.paths;
const path: string = module.path;
paths = m1.paths;
const customRequire1 = moduleModule.createRequireFromPath('./test');