Skip to content

Support TextEncoder & TextDecoder #1611

@Ayc0

Description

@Ayc0

Is your feature request related to a problem? Please describe.

On the global scope, TextEncoder & TextDecoder are available (see MDN).

But when I run this code:

const h = require('happy-dom');
const w = new h.Window();
w.TextEncoder // undefined

This poses an issue for tests running in Jest with @happy-dom/jest-environment, testing code using TextEncoder

Describe the solution you'd like
Implement those 2 globals by exposing those from node:util

Describe alternatives you've considered
N/A

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions