11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_cirequire('../common'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst { createRequire } = require('module'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst u = fixtures.fileURL('fake.js'); 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ciconst reqToo = createRequire(u); 121cb0ef41Sopenharmony_ciassert.deepStrictEqual(reqToo('./experimental'), { ofLife: 42 }); 131cb0ef41Sopenharmony_ci 141cb0ef41Sopenharmony_ciassert.throws(() => { 151cb0ef41Sopenharmony_ci createRequire('https://github.com/nodejs/node/pull/27405/'); 161cb0ef41Sopenharmony_ci}, { 171cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE' 181cb0ef41Sopenharmony_ci}); 191cb0ef41Sopenharmony_ci 201cb0ef41Sopenharmony_ciassert.throws(() => { 211cb0ef41Sopenharmony_ci createRequire('../'); 221cb0ef41Sopenharmony_ci}, { 231cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE' 241cb0ef41Sopenharmony_ci}); 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ciassert.throws(() => { 271cb0ef41Sopenharmony_ci createRequire({}); 281cb0ef41Sopenharmony_ci}, { 291cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_VALUE', 301cb0ef41Sopenharmony_ci message: 'The argument \'filename\' must be a file URL object, file URL ' + 311cb0ef41Sopenharmony_ci 'string, or absolute path string. Received {}' 321cb0ef41Sopenharmony_ci}); 33