diff --git a/demos/bundlers.mjs b/demos/bundlers.mjs index ff90414eb..650363a97 100644 --- a/demos/bundlers.mjs +++ b/demos/bundlers.mjs @@ -52,8 +52,8 @@ QUnit.test.each('test in Node.js [indirect]', indirectFiles, function (assert, f { cwd: DIR, env: { qunit_config_reporters_tap: 'true' }, encoding: 'utf8' } ); const expected = ` -1..4 -# pass 4 +1..5 +# pass 5 # skip 0 # todo 0 # fail 0`.trim(); @@ -76,25 +76,29 @@ Testing http://localhost:8000/tmp/test-import-default.umd.html .OK >> passed test "import-default" Testing http://localhost:8000/tmp/test-import-default.webpack.html .OK >> passed test "import-default" -Testing http://localhost:8000/tmp/test-import-indirect.es.html ....OK +Testing http://localhost:8000/tmp/test-import-indirect.es.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "import-indirect" -Testing http://localhost:8000/tmp/test-import-indirect.iife.html ....OK +Testing http://localhost:8000/tmp/test-import-indirect.iife.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "import-indirect" -Testing http://localhost:8000/tmp/test-import-indirect.umd.html ....OK +Testing http://localhost:8000/tmp/test-import-indirect.umd.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "import-indirect" -Testing http://localhost:8000/tmp/test-import-indirect.webpack.html ....OK +Testing http://localhost:8000/tmp/test-import-indirect.webpack.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "import-indirect" Testing http://localhost:8000/tmp/test-import-named.es.html .OK >> passed test "import-named" @@ -112,27 +116,39 @@ Testing http://localhost:8000/tmp/test-require-default.umd.html .OK >> passed test "require-default" Testing http://localhost:8000/tmp/test-require-default.webpack.html .OK >> passed test "require-default" -Testing http://localhost:8000/tmp/test-require-indirect.es.html ....OK +Testing http://localhost:8000/tmp/test-require-indirect.es.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "require-indirect" -Testing http://localhost:8000/tmp/test-require-indirect.iife.html ....OK +Testing http://localhost:8000/tmp/test-require-indirect.iife.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "require-indirect" -Testing http://localhost:8000/tmp/test-require-indirect.umd.html ....OK +Testing http://localhost:8000/tmp/test-require-indirect.umd.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "require-indirect" -Testing http://localhost:8000/tmp/test-require-indirect.webpack.html ....OK +Testing http://localhost:8000/tmp/test-require-indirect.webpack.html .....OK >> passed test "import-default" >> passed test "import-named" >> passed test "require-default" +>> passed test "require-sub" >> passed test "require-indirect" ->> 44 tests completed in 42ms, with 0 failed, 0 skipped, and 0 todo. +Testing http://localhost:8000/tmp/test-require-sub.es.html .OK +>> passed test "require-sub" +Testing http://localhost:8000/tmp/test-require-sub.iife.html .OK +>> passed test "require-sub" +Testing http://localhost:8000/tmp/test-require-sub.umd.html .OK +>> passed test "require-sub" +Testing http://localhost:8000/tmp/test-require-sub.webpack.html .OK +>> passed test "require-sub" +>> 56 tests completed in 42ms, with 0 failed, 0 skipped, and 0 todo. Done.`; diff --git a/demos/bundlers/build.mjs b/demos/bundlers/build.mjs index 17c7d66a4..d87e2469c 100644 --- a/demos/bundlers/build.mjs +++ b/demos/bundlers/build.mjs @@ -15,6 +15,7 @@ const inputs = [ `${dirname}/test/import-named.js`, `${dirname}/test/import-indirect.js`, `${dirname}/test/require-default.cjs`, + `${dirname}/test/require-sub.cjs`, `${dirname}/test/require-indirect.cjs` ]; diff --git a/demos/bundlers/test/import-indirect.js b/demos/bundlers/test/import-indirect.js index 7800fd83f..f5ad7175c 100644 --- a/demos/bundlers/test/import-indirect.js +++ b/demos/bundlers/test/import-indirect.js @@ -2,6 +2,7 @@ import './import-default.js'; import './import-named.js'; import './require-default.cjs'; +import './require-sub.cjs'; import QUnit from 'qunit'; @@ -17,4 +18,8 @@ QUnit.test('import-indirect', function (assert) { assert.strictEqual(TEST_OBJECTS.require_default, QUnit, 'identity'); assert.strictEqual(QUnit.hello_require_default, 'require-default', 'extend QUnit'); assert.strictEqual(assert.hello_require_default, 'require-default', 'extend assert'); + + assert.strictEqual(TEST_OBJECTS.require_sub, QUnit, 'identity'); + assert.strictEqual(QUnit.hello_require_sub, 'require-sub', 'extend QUnit'); + assert.strictEqual(assert.hello_require_sub, 'require-sub', 'extend assert'); }); diff --git a/demos/bundlers/test/require-indirect.cjs b/demos/bundlers/test/require-indirect.cjs index a6bcbbda1..c0c202ff0 100644 --- a/demos/bundlers/test/require-indirect.cjs +++ b/demos/bundlers/test/require-indirect.cjs @@ -4,6 +4,7 @@ const QUnit = require('qunit'); require('./import-default.js'); require('./import-named.js'); require('./require-default.cjs'); +require('./require-sub.cjs'); QUnit.test('require-indirect', function (assert) { assert.strictEqual(TEST_OBJECTS.import_default, QUnit, 'identity'); @@ -17,4 +18,8 @@ QUnit.test('require-indirect', function (assert) { assert.strictEqual(TEST_OBJECTS.require_default, QUnit, 'identity'); assert.strictEqual(QUnit.hello_require_default, 'require-default', 'extend QUnit'); assert.strictEqual(assert.hello_require_default, 'require-default', 'extend assert'); + + assert.strictEqual(TEST_OBJECTS.require_sub, QUnit, 'identity'); + assert.strictEqual(QUnit.hello_require_sub, 'require-sub', 'extend QUnit'); + assert.strictEqual(assert.hello_require_sub, 'require-sub', 'extend assert'); }); diff --git a/demos/bundlers/test/require-sub.cjs b/demos/bundlers/test/require-sub.cjs new file mode 100644 index 000000000..07efbf958 --- /dev/null +++ b/demos/bundlers/test/require-sub.cjs @@ -0,0 +1,10 @@ +const QUnit = require('qunit').QUnit; +const { add } = require('./src.js'); + +(globalThis.TEST_OBJECTS || (globalThis.TEST_OBJECTS = {})).require_sub = QUnit; + +QUnit.hello_require_sub = QUnit.assert.hello_require_sub = 'require-sub'; + +QUnit.test('require-sub', function (assert) { + assert.equal(add(2, 3), 5); +});