thorocT
Denoβ€’11mo agoβ€’
5 replies
thoroc

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' }]),
  );


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");
Was this page helpful?