qunitjs / qunitjs/qunit

Don't follow prototype chain in diff

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

Nobody has claimed this yet.

Component: Diff Component: HTML Reporter Type: Enhancement
Dominant language
JavaScript
Stars
4k
Forks
773
PR merge metrics
No merged PRs in 30d

Description

Hi

When a test case fails, the 'actual' and 'expected' values gets logged to screen. When these values are objects with many properties/functions on their prototype chains, the logged text gets huge and (always?) pretty irrelevant.
Is there a way to tell QUnit not to follow prototype chains?

Here's an example of a way too big logging:

"Expected:

{
  "add": function add( a, b ){
    [code]
  },
  "addScalar": function addScalar( a ){
    [code]
  },
  "addScaledVector": function addScaledVector( a, b ){
    [code]
  },
  "addVectors": function addVectors( a, b ){
    [code]
  },
  "angleTo": function angleTo( a ){
    [code]
  },
  "applyAxisAngle": function applyAxisAngle( a, b ){
    [code]
  },
  "applyEuler": function applyEuler( a ){
    [code]
  },
  "applyMatrix3": function applyMatrix3( a ){
    [code]
  },
  "applyMatrix4": function applyMatrix4( a ){
    [code]
  },
  "applyProjection": function applyProjection( a ){
    [code]
  },
  "applyQuaternion": function applyQuaternion( a ){
    [code]
  },
  "ceil": function ceil(){
    [code]
  },
  "changeBasis": function changeBasis( a, b, c, d ){
    [code]
  },
  "clamp": function clamp( a, b ){
    [code]
  },
  "clampLength": function clampLength( a, b ){
    [code]
  },
  "clampScalar": function clampScalar( a, b ){
    [code]
  },
  "clone": function clone(){
    [code]
  },
  "constructor": function Vector3( a, b, c ){
    [code]
  },
  "copy": function copy( a ){
    [code]
  },
  "cross": function cross( a, b ){
    [code]
  },
  "crossVectors": function crossVectors( a, b ){
    [code]
  },
  "distanceTo": function distanceTo( a ){
    [code]
  },
  "distanceToManhattan": function distanceToManhattan( a ){
    [code]
  },
  "distanceToSquared": function distanceToSquared( a ){
    [code]
  },
  "divide": function divide( a ){
    [code]
  },
  "divideScalar": function divideScalar( a ){
    [code]
  },
  "dot": function dot( a ){
    [code]
  },
  "equals": function equals( a ){
    [code]
  },
  "floor": function floor(){
    [code]
  },
  "fromArray": function fromArray( a, b ){
    [code]
  },
  "fromAttribute": function fromAttribute( a, b, c ){
    [code]
  },
  "fromBufferAttribute": function fromBufferAttribute( a, b, c ){
    [code]
  },
  "getColumnFromMatrix": function getColumnFromMatrix( a, b ){
    [code]
  },
  "getComponent": function getComponent( a ){
    [code]
  },
  "getPositionFromMatrix": function getPositionFromMatrix( a ){
    [code]
  },
  "getScaleFromMatrix": function getScaleFromMatrix( a ){
    [code]
  },
  "isVector3": true,
  "length": function length(){
    [code]
  },
  "lengthManhattan": function lengthManhattan(){
    [code]
  },
  "lengthSq": function lengthSq(){
    [code]
  },
  "lerp": function lerp( a, b ){
    [code]
  },
  "lerpVectors": function lerpVectors( a, b, c ){
    [code]
  },
  "max": function max( a ){
    [code]
  },
  "min": function min( a ){
    [code]
  },
  "multiply": function multiply( a, b ){
    [code]
  },
  "multiplyScalar": function multiplyScalar( a ){
    [code]
  },
  "multiplyVectors": function multiplyVectors( a, b ){
    [code]
  },
  "negate": function negate(){
    [code]
  },
  "normalize": function normalize(){
    [code]
  },
  "project": function project( a ){
    [code]
  },
  "projectOnPlane": function projectOnPlane( a ){
    [code]
  },
  "projectOnVector": function projectOnVector( a ){
    [code]
  },
  "reflect": function reflect( a ){
    [code]
  },
  "rejectOnVector": function rejectOnVector( a ){
    [code]
  },
  "round": function round(){
    [code]
  },
  "roundToZero": function roundToZero(){
    [code]
  },
  "set": function set( a, b, c ){
    [code]
  },
  "setComponent": function setComponent( a, b ){
    [code]
  },
  "setEulerFromQuaternion": function setEulerFromQuaternion(){
    [code]
  },
  "setEulerFromRotationMatrix": function setEulerFromRotationMatrix(){
    [code]
  },
  "setFromCylindrical": function setFromCylindrical( a ){
    [code]
  },
  "setFromMatrixColumn": function setFromMatrixColumn( a, b ){
    [code]
  },
  "setFromMatrixPosition": function setFromMatrixPosition( a ){
    [code]
  },
  "setFromMatrixScale": function setFromMatrixScale( a ){
    [code]
  },
  "setFromSpherical": function setFromSpherical( a ){
    [code]
  },
  "setLength": function setLength( a ){
    [code]
  },
  "setScalar": function setScalar( a ){
    [code]
  },
  "setX": function setX( a ){
    [code]
  },
  "setY": function setY( a ){
    [code]
  },
  "setZ": function setZ( a ){
    [code]
  },
  "sub": function sub( a, b ){
    [code]
  },
  "subScalar": function subScalar( a ){
    [code]
  },
  "subVectors": function subVectors( a, b ){
    [code]
  },
  "toArray": function toArray( a, b ){
    [code]
  },
  "transformDirection": function transformDirection( a ){
    [code]
  },
  "unproject": function unproject( a ){
    [code]
  },
  "x": 0,
  "y": 0,
  "z": 0
}"

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

No source file or test is named in the issue. Start by locating QUnit’s diff-formatting path for actual and expected values and its regression tests; done means prototype methods are omitted from displayed diffs while own properties remain visible for the reported object case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.