3 const path = require( "node:path" );
5 const ROOT_DIR = path.resolve( __dirname, "..", "..", "..", ".." );
7 // If `jQueryModuleSpecifier` is a real relative path, make it absolute
8 // to make sure it resolves to the same file inside utils from
9 // a subdirectory. Otherwise, leave it as-is as we may be testing `exports`
10 // so we need input as-is.
11 const getJQueryModuleSpecifier = () => {
12 const jQueryModuleInputSpecifier = process.argv[ 2 ];
13 if ( !jQueryModuleInputSpecifier ) {
14 throw new Error( "jQuery module specifier not passed" );
17 return jQueryModuleInputSpecifier.startsWith( "." ) ?
18 path.resolve( ROOT_DIR, jQueryModuleInputSpecifier ) :
19 jQueryModuleInputSpecifier;
22 module.exports = { getJQueryModuleSpecifier };