MCPcopy Create free account
hub / github.com/EvoMap/evolver / withEnv

Function withEnv

test/runtimePaths.test.js:289–294  ·  view source on GitHub ↗
(key, val, fn)

Source from the content-addressed store, hash-verified

287 // fixed path, not a version scan. Verified against volta-cli/volta
288 // volta-layout v4 `package_image_dir` + package/manager.rs `source_dir`.
289 function withEnv(key, val, fn) {
290 const orig = process.env[key];
291 if (val === undefined) delete process.env[key]; else process.env[key] = val;
292 try { return fn(); }
293 finally { if (orig === undefined) delete process.env[key]; else process.env[key] = orig; }
294 }
295
296 it('includes <VOLTA_HOME>/tools/image/packages/@evomap/evolver/lib/node_modules', () => {
297 withEnv('VOLTA_HOME', path.join(os.tmpdir(), 'fake-volta'), () => {

Callers 1

Calls 1

fnFunction · 0.70

Tested by

no test coverage detected