From 48c3b8c942807f400d43f4fe53bf78f9c860c470 Mon Sep 17 00:00:00 2001 From: harryadel Date: Mon, 12 Jul 2021 20:56:46 +0200 Subject: [PATCH] Add note about fail --- packages/tinytest/README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/tinytest/README.md b/packages/tinytest/README.md index 8f5deec74b..35025a7942 100644 --- a/packages/tinytest/README.md +++ b/packages/tinytest/README.md @@ -317,6 +317,24 @@ Call this to fail the test with an exception that occurs inside asynchronous cal - the test doesn't call its callback (onComplete function). - the test function doesn't directly raise an exception. +### fail + +`test.fail(doc);` + +Can be used to output a detailed message about a failure with path and value. + +Example call: +```js +test.fail({ + type: 'match-error-path', + message: "The path of Match.Error doesn't match.", + pattern: JSON.stringify(pattern), + value: JSON.stringify(value), + path: err.path, + expectedPath, + }); +``` + #### expect_fail `test.expect_fail();`