qunitjs / qunitjs/qunit

propEqual should treat TypedArray as arrays

Open
#1,114 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Assert help welcome Type: Enhancement
Dominant language
JavaScript
Stars
4k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

Tell us about your runtime:

  • QUnit version: current
  • What environment are you running QUnit in? (e.g., browser, Node): browser/any
  • How are you running QUnit? (e.g., script, testem, Grunt): QUnit

What are you trying to do?

I'm trying to use deepEqual to compare an array with a typedarray instance

Code that reproduces the problem:

var { test } = QUnit;

test('float64Array', t => {
  var sample = new Float64Array([1, 2, 3, 4, 5, 6, 7, 8])
  var src = new Float32Array(sample.buffer, 0, 2);

  src[0] = 42;

  sample.set(src, 1);

  t.deepEqual(sample, [1.0000002464512363, 42, 1.875, 4, 5, 6, 7, 8])
})

If you have any relevant configuration information, please include that here:

What did you expect to happen?

being able to compare values between instances

What actually happened?

captura de tela 2017-03-13 17 40 11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported deepEqual reproduction using Float64Array, Float32Array, and a regular array. Determine how propEqual/deepEqual currently compares typed arrays and define completion as correctly comparing the values between typed-array and array instances; the payload names no files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.