From 9c056406ea98089d379b0531f41c6b9eb96ac832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 28 Feb 2015 18:11:48 -0500 Subject: [PATCH 1/2] Update the guide to mention the showDiff argument of assert --- data/guide/plugins/assert.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/data/guide/plugins/assert.md b/data/guide/plugins/assert.md index fde88e56..478ba959 100644 --- a/data/guide/plugins/assert.md +++ b/data/guide/plugins/assert.md @@ -32,13 +32,15 @@ the assertion failed and the first error message will be thrown as part of a `ch Conversely, if the language chain was negated, it will consider `false` a pass and `true` a failure. The second error message will be included in the thrown error instead. -In all, the `assert` method accepts five arguments: +In all, the `assert` method accepts six arguments: 1. a boolean (result of a truth test) 2. a string error message to be used if the first argument is `false` 3. a string error message to be used if the assertion is negated and the first argument is `true` 4. (optional) the expected value 5. (optional) the actual value, which will default to `_obj` +6. (optional) a boolean which indicates whether to display a diff in addition to the message if the first argument is `false` + ### Composing Error Messages From b79ed485ad11a55941579f425f7d05dff298478d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Astori?= Date: Sat, 28 Feb 2015 18:14:55 -0500 Subject: [PATCH 2/2] Update the generated guide to mention the showDiff argument of assert --- out/guide/plugins/index.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/out/guide/plugins/index.html b/out/guide/plugins/index.html index d63d32e5..9871a9b9 100644 --- a/out/guide/plugins/index.html +++ b/out/guide/plugins/index.html @@ -173,13 +173,14 @@

Basic Assertion

the assertion failed and the first error message will be thrown as part of a chai.AssertionError. Conversely, if the language chain was negated, it will consider false a pass and true a failure. The second error message will be included in the thrown error instead.

-

In all, the assert method accepts five arguments:

+

In all, the assert method accepts six arguments:

  1. a boolean (result of a truth test)
  2. a string error message to be used if the first argument is false
  3. a string error message to be used if the assertion is negated and the first argument is true
  4. (optional) the expected value
  5. (optional) the actual value, which will default to _obj
  6. +
  7. (optional) a boolean which indicates whether to display a diff in addition to the message if the first argument is false

Composing Error Messages

As you can see from the above example, Chai can accept template tags to dynamically compose @@ -232,4 +233,4 @@

Chai Assertion Library

- \ No newline at end of file +