From e9fdfae6e6b0ec4fc277b22f947e6aeb21f07669 Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 15 Nov 2022 12:27:35 -0700 Subject: [PATCH] fix: update error stack traces for Cypress (#239) Fixes #232 Update the Cypress error message rather than the entire error object. This merges the useful message of DOM Testing Library with the useful context of the Cypress error. This allows Cypress to find the line number of the failure in spec files instead of deep inside DOM Testing Library. --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 1275213..ee5f303 100644 --- a/src/index.js +++ b/src/index.js @@ -109,7 +109,7 @@ function createCommand(queryName, implementationName) { onFail: () => { // We want to override Cypress's normal non-existence message with @testing-library/dom's more helpful ones if (error) { - options.error = error + options.error.message = error.message } }, })