thoroc
thoroc
DDeno
Created by thoroc on 2/20/2025 in #help
Stubbing @std/x
I need some help understanding how to use the stub() method with @std/x libraries.
import * as stdYaml from 'jsr:@std/yaml';

using _parse = stub(
stdYaml,
'parse',
returnsNext([{ version: '3.8' }]),
);
import * as stdYaml from 'jsr:@std/yaml';

using _parse = stub(
stdYaml,
'parse',
returnsNext([{ version: '3.8' }]),
);
The code above seems to satisfy the linter, but the test obviously fails with the following:
sh
error: MockError: Cannot stub: non-configurable instance method
throw new MockError("Cannot stub: non-configurable instance method");
sh
error: MockError: Cannot stub: non-configurable instance method
throw new MockError("Cannot stub: non-configurable instance method");
6 replies