Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HTML Reporter: Fix broken "Rerun without max depth" link
=== Background The documentation was added in qunitjs/api.qunitjs.com#132, but the check has always been "if (maxDepth && depth > maxDepth)", which means the only way to disable the limit is null (or 0). Setting -1 has never had the effect allowing infinite depth. Instead, it is equivalent to a limit 0, whereby even `["x"]` at depth=0 is considered exceeding -1 and thus formatted as `[object Array]`. Note that actually setting `0` doesn't set a limit of 0, since 0 is falsey so it behaves the same as null or Infinity (i.e. no limit). The origin of this mistake is most likely the HTML Reporter feature that adds a "Rerun" link with "maxDepth=-1" set in the url params, when the diff contains an "[object" placeholder indicating that the diff is incomplete. This feature was introduced in QUnit 1.18 with e6976c3 and ecc33ac. This feature broke the very next release in 1.19, after only a few months, due to 825691f ("Split source to smaller files") which removed a chunk of code from core.js without moving it elsewhere. This chunk included: ```js if ( urlParams.maxDepth ) { config.maxDepth = parseInt( urlParams.maxDepth, 10 ) === -1 ? Number.POSITIVE_INFINITY : urlParams.maxDepth; } ``` In the 1.18 release, where the feature briefly worked, it was specifically parsing -1 in `urlParams.maxDepth` as Infinity. It did not apply to QUnit.config.maxDepth (preconfig) and did not apply to QUnit.dump.maxDepth (runtime changes). === What I'm changing the docs for `QUnit.config.maxDepth` to say "0" for "no limit". Our own tests used "null" which also works. I'm standardising on "0" because it doesn't require any special-casing that way. We can simply document it as "number", and let all ENV preconfig and url params parse it as such, and it just works, without special cases for somehow parsing "null" or "-1" in a special way.
- Loading branch information