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

Function testReload

test-modules.js:83–91  ·  view source on GitHub ↗

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

(assert)

Source from the content-addressed store, hash-verified

81
82/** @param {import('tap').Test} assert */
83function testReload (assert) {
84 const stringify = require('./wrapper.cjs')
85 delete require.cache[require.resolve('./wrapper.cjs')]
86 delete require.cache[require.resolve('./index.js')]
87 const reloaded = require('./wrapper.cjs')
88 assert.equal(reloaded, stringify, 're-evaluation preserves the export')
89 assert.equal(reloaded({ b: 2, a: 1 }), '{"a":1,"b":2}')
90 assert.end()
91}
92
93test('module re-evaluation reuses the retained export', testReload)
94

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected