There's more...

Your Chai assertion library can do more than just providing utilities for assertions in your tests; it can also provide you configuration for them. These configuration options let you decide how you want your assertion failures to be presented to you by Chai. For example, the chai.config.includeStack flag is false by default. However, by configuring it to on, you can influence whether a stack trace is included in the assertion error message:

chai.config.includeStack = true;

The chai.config.showDiff flag is true by default, and it controls whether a difference of the expected value from the received value is displayed for the assertion:

chai.config.showDiff = false;

Finally, the chai.config.truncate threshold flag sets the number of lines in a function, object, or array that will be presented in the assertion error before being truncated. The value is set to 40 by default, and you can set it to 0 to completely disable truncation in the assertion:

chai.config.truncateThreshold = 0; // disable truncating

With these configuration options, you can tailor your expected output from Chai to what is most useful for you.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.19.244.187