-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Describe the bug
Checking the uint8.buffer instance fails when checking with the global ArrayBuffer class.
/**
* @vitest-environment jsdom
*/
describe(() => {
it('arraybuffer', async () => {
const uint8 = new Uint8Array([1]);
expect(uint8.constructor.name).toBe('Uint8Array');
expect(uint8 instanceof Uint8Array).toBeTruthy();
expect(ArrayBuffer.isView(uint8)).toBeTruthy();
expect(uint8.buffer instanceof ArrayBuffer).toBeTruthy();
});
});When using @vitest-environment jsdom.
Using node works well, tho.
This scenario should work in the browser as seen here:

Using:
"vitest@0.28.4"
"jsdom@22.1.0"
Reproduction
/**
* @vitest-environment jsdom
*/
describe(() => {
it('arraybuffer', async () => {
const uint8 = new Uint8Array([1]);
expect(uint8.constructor.name).toBe('Uint8Array');
expect(uint8 instanceof Uint8Array).toBeTruthy();
expect(ArrayBuffer.isView(uint8)).toBeTruthy();
expect(uint8.buffer instanceof ArrayBuffer).toBeTruthy();
});
});System Info
System:
OS: macOS 13.5
CPU: (10) arm64 Apple M1 Pro
Memory: 1.18 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.18.1 - ~/.nvm/versions/node/v16.18.1/bin/node
Yarn: 1.19.0 - ~/Workspace/platform/client-applications/node_modules/.bin/yarn
npm: 8.19.2 - ~/.nvm/versions/node/v16.18.1/bin/npm
Browsers:
Chrome: 115.0.5790.170
Chrome Canary: 118.0.5953.0
Edge: 115.0.1901.200
Firefox: 116.0.2
Safari: 16.6Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels