Core: Fix the exports setup to make bundlers work with ESM & CommonJS
[jquery.git] / test / node_smoke_tests / dual / factory / import-and-require-factory.js
blobc94ae374e79311ac00e2105327778896da1533bb
1 import assert from "node:assert/strict";
2 import { JSDOM } from "jsdom";
4 const { window } = new JSDOM( "" );
6 const { jQueryFactory: factoryImported } = await import( process.argv[ 2 ] );
7 const { jQueryFactory: factoryRequired } = await import( "../lib/jquery-require-factory.cjs" );
9 assert( factoryImported === factoryRequired,
10         "More than one copy of jQueryFactory exists" );
12 assert( !( "expando" in factoryImported ),
13         "jQuery.expando should not be attached to the factory" );
15 const $ = factoryImported( window );
17 assert( /^jQuery/.test( $.expando ), "jQuery.expando should be detected" );