Commit 88a545a

Anton Golub <antongolub@antongolub.com>
2024-10-04 16:09:22
feat: keep argv ref on update (#916)
Co-authored-by: Anton Medvedev <anton@medv.io>
1 parent ac2f1dd
Changed files (2)
src/goods.ts
@@ -27,10 +27,10 @@ import {
 export { default as path } from 'node:path'
 export * as os from 'node:os'
 
-export let argv = minimist(process.argv.slice(2))
+export const argv = minimist(process.argv.slice(2))
 export function updateArgv(args: string[]) {
-  argv = minimist(args)
-  ;(global as any).argv = argv
+  for (var k in argv) delete argv[k]
+  Object.assign(argv, minimist(args))
 }
 
 export function sleep(duration: Duration) {
test/goods.test.js
@@ -14,7 +14,7 @@
 
 import chalk from 'chalk'
 import assert from 'node:assert'
-import { test, describe, beforeEach } from 'node:test'
+import { test, describe } from 'node:test'
 import '../build/globals.js'
 
 describe('goods', () => {