diff --git a/docs/api/config/maxDepth.md b/docs/api/config/maxDepth.md index 4a0f9b470..3121fd68a 100644 --- a/docs/api/config/maxDepth.md +++ b/docs/api/config/maxDepth.md @@ -22,6 +22,11 @@ In the HTML Reporter, the depth up-to which an object will be serialized during -To disable the depth limit, use a value of `-1`. +To disable the depth limit and allow infinite depth, use a value of `0`. This is used by [`QUnit.dump.parse()`](../extension/QUnit.dump.parse.md). + +## Changelog + +| [QUnit 1.18](https://github.com/qunitjs/qunit/releases/tag/1.18.0) | Introduce `QUnit.config.maxDepth` to enable setting via [preconfig](./index.md). Temporary changes at runtime must change `QUnit.dump.maxDepth` instead. +| [QUnit 1.16](https://github.com/qunitjs/qunit/releases/tag/1.16.0) | Introduce `QUnit.dump.maxDepth`. diff --git a/src/core/config.js b/src/core/config.js index 9071bb730..79f2ffc08 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -235,6 +235,7 @@ if (preConfig) { // Apply QUnit.urlParams // in accordance with /docs/api/config.index.md#order readFlatPreconfigString(urlParams.filter, 'filter'); +readFlatPreconfigNumber(urlParams.maxDepth, 'maxDepth'); readFlatPreconfigString(urlParams.module, 'module'); if (urlParams.moduleId) { config.moduleId = [].concat(urlParams.moduleId); diff --git a/src/reporters/HtmlReporter.js b/src/reporters/HtmlReporter.js index fb5ad0310..749b07e80 100644 --- a/src/reporters/HtmlReporter.js +++ b/src/reporters/HtmlReporter.js @@ -855,7 +855,7 @@ export default class HtmlReporter { 'Diff suppressed as the depth of object is more than current max depth (' + this.config.maxDepth + ').

Hint: Use QUnit.dump.maxDepth to ' + ' run with a higher max depth or " + + escapeText(this.makeUrl({ maxDepth: 0 })) + "'>" + 'Rerun without max depth.

'; } else { message += 'Message: ' + diff --git a/test/main/dump.js b/test/main/dump.js index 8513dc2de..44991bc2e 100644 --- a/test/main/dump.js +++ b/test/main/dump.js @@ -1,9 +1,13 @@ /* globals document, Symbol */ QUnit.module('dump', { + beforeEach: function () { + // Run most tests without a limit + QUnit.dump.maxDepth = 0; + }, afterEach: function () { // Restore default - QUnit.dump.maxDepth = null; + QUnit.dump.maxDepth = 5; } });