MCPcopy Create free account
hub / github.com/BridgeAR/safe-stable-stringify / testModuleEntryPoints

Function testModuleEntryPoints

test-modules.js:61–78  ·  view source on GitHub ↗

@param {import('tap').Test} assert

(assert)

Source from the content-addressed store, hash-verified

59
60/** @param {import('tap').Test} assert */
61async function testModuleEntryPoints (assert) {
62 const directory = createPackageFixture(assert)
63 writePackage(join(directory, 'same-version'), version)
64 writePackage(join(directory, 'other-version'), '0.0.0-test')
65 for (const name of ['first', 'second']) {
66 writeFileSync(join(directory, `${name}.cjs`), "module.exports = require('safe-stable-stringify')\n")
67 writeFileSync(join(directory, `${name}.mjs`), "export { default, configure, stringify } from 'safe-stable-stringify'\n")
68 }
69
70 const results = await Promise.all([
71 runNode(['modules.cjs', 'require-first'], { cwd: directory }),
72 runNode(['modules.cjs', 'import-first'], { cwd: directory })
73 ])
74 for (const { stdout, stderr } of results) {
75 assert.equal(stdout, '', 'no output')
76 assert.equal(stderr, '', 'no errors')
77 }
78}
79
80test('module entry points share exports across consumers and load orders', testModuleEntryPoints)
81

Callers

nothing calls this directly

Calls 3

createPackageFixtureFunction · 0.85
writePackageFunction · 0.85
runNodeFunction · 0.85

Tested by

no test coverage detected