node-text-codec-globals
Restores Node’s TextEncoder and TextDecoder on a test environment’s global object that lacks them.
vitest’s jsdom environment copies both from Node, but jest-environment-jsdom does not, so under Jest an @mnaoumov/obsidian-lib plugin’s onload threw ReferenceError: TextEncoder is not defined. The generic restoreNodeWebGlobals from @mnaoumov/typescript-test-toolkit does not cover these two names.
Functions
Section titled “Functions”| Function | Description |
|---|---|
| restoreNodeTextCodecGlobals | Defines each of TextEncoder and TextDecoder on the target from node:util, unless the target already has it. |
Variables
Section titled “Variables”| Variable | Description |
|---|---|
| NODE_TEXT_CODEC_GLOBALS | The text codec classes this module restores, by global name. |