@@ -24,6 +24,7 @@ require('../common');
2424const assert = require ( 'assert' ) ;
2525const path = require ( 'path' ) ;
2626const fs = require ( 'fs' ) ;
27+ const errors = require ( '../../lib/internal/errors' ) ;
2728
2829console . error ( 'load test-module-loading.js' ) ;
2930
@@ -120,8 +121,10 @@ console.error('test name clashes');
120121const my_path = require ( '../fixtures/path' ) ;
121122assert . ok ( my_path . path_func instanceof Function ) ;
122123// this one does not exist and should throw
123- assert . throws ( function ( ) { require ( './utils' ) ; } ,
124- / ^ E r r o r : C a n n o t f i n d m o d u l e ' .\/ u t i l s ' $ / ) ;
124+ const notFoundPath = './utils' ;
125+ const notFoundError = new errors . Error ( 'MODULE_NOT_FOUND' , notFoundPath ) ;
126+ assert . throws ( function ( ) { require ( notFoundPath ) ; } ,
127+ new RegExp ( notFoundError . message ) ) ;
125128
126129let errorThrown = false ;
127130try {
@@ -224,6 +227,7 @@ const children = module.children.reduce(function red(set, child) {
224227
225228assert . deepStrictEqual ( children , {
226229 'common.js' : { } ,
230+ '../lib/internal/errors.js' : { } ,
227231 'fixtures/not-main-module.js' : { } ,
228232 'fixtures/a.js' : {
229233 'fixtures/b/c.js' : {
0 commit comments