Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-fixed-jsdom

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-fixed-jsdom - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

2

index.js

@@ -9,2 +9,4 @@ const JSDOMEnvironment = require('jest-environment-jsdom').default

this.global.TextEncoder = TextEncoder
this.global.TextDecoderStream = TextDecoderStream
this.global.TextEncoderStream = TextEncoderStream
this.global.ReadableStream = ReadableStream

@@ -11,0 +13,0 @@

@@ -25,2 +25,40 @@ const { URL: BuiltinURL } = require('node:url')

test('exposes "TextEncoderStream"', async () => {
expect(globalThis).toHaveProperty('TextEncoderStream')
expect(() => new TextEncoderStream()).not.toThrow()
const stream = new TextEncoderStream()
const writer = stream.writable.getWriter()
writer.write('hello')
writer.close()
const reader = stream.readable.getReader()
const chunks = []
while (true) {
const { done, value } = await reader.read()
if (done) break
chunks.push(...value)
}
expect(Buffer.from(chunks)).toEqual(Buffer.from(new Uint8Array([104, 101, 108, 108, 111])))
})
test('exposes "TextDecoderStream"', async () => {
expect(globalThis).toHaveProperty('TextDecoderStream')
expect(() => new TextDecoderStream()).not.toThrow()
const stream = new TextDecoderStream()
const writer = stream.writable.getWriter()
writer.write(new Uint8Array([104, 101, 108, 108, 111]))
writer.close()
const reader = stream.readable.getReader()
const chunks = []
while (true) {
const { done, value } = await reader.read()
if (done) break
chunks.push(value)
}
expect(chunks.join('')).toBe('hello')
})
test('exposes "ReadableStream"', () => {

@@ -27,0 +65,0 @@ expect(globalThis).toHaveProperty('ReadableStream')

2

package.json
{
"name": "jest-fixed-jsdom",
"version": "0.0.4",
"version": "0.0.5",
"description": "A superset of the JSDOM environment for Jest that respects Node.js globals.",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -35,2 +35,4 @@ <h1 align="center">jest-fixed-jsdom</h1>

- `TextDecoder`
- `TextEncoderStream`
- `TextDecoderStream`
- `structuredClone()`

@@ -37,0 +39,0 @@ - `URL`

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc