From 85ab956c72323b3547fd4acd4b9fe2613ed5fd9a Mon Sep 17 00:00:00 2001 From: Nicholas Boll Date: Tue, 15 Nov 2022 12:16:37 -0700 Subject: [PATCH] fix: update error stack traces for Cypress 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 i nstead 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 } }, })