I am migrating from sinon to the native node:test library.
Before I mocked argv with sinon like so;
import { stub } from 'sinon'
stub(process, 'argv').get(() => ['node-path', 'application-entry', 'first-arg']
The following with node:test is not working;
import { mock } from "node:test"
mock.getter(Process, 'argv').mock.mockImplementation(() => ['node-path', 'application-entry', 'first-arg'])
I get the following error;
TypeError [ERR_INVALID_ARG_VALUE]: The argument 'methodName' must be a method. Received undefined
I never found a solution to this (and mocking many other native libraries with the native mocking library) but in this case I did the obvious and injected argv into a function and didn't bother testing it directly