Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Print link to the Testing-Library playground when getBy* queries fail #852

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
},
"devDependencies": {
"@testing-library/jest-dom": "^5.11.6",
"@types/lz-string": "^1.3.34",
"jest-in-case": "^1.0.2",
"jest-serializer-ansi": "^1.0.3",
"jest-watch-select-projects": "^2.0.0",
Expand Down
26 changes: 26 additions & 0 deletions src/__tests__/__snapshots__/get-by-errors.js.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`getByLabelText query will print the playground link when enabled in the config 1`] = `
"Unable to find a label with the text of: TEST QUERY

<body>
<div>
Hello
</div>
</body>

Open this markup in the Testing-Library Playground:
https://testing-playground.com/#markup=DwEwlgbgfAEgpgGwQe2AenNIA"
`;

exports[`getByLabelText query will throw the custom error returned by config.getElementError 1`] = `"My custom error: Unable to find a label with the text of: TEST QUERY"`;

exports[`getByText query will print the playground link when enabled in the config 1`] = `
"Unable to find an element with the text: TEST QUERY. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.

<body>
<div>
Hello
</div>
</body>

Open this markup in the Testing-Library Playground:
https://testing-playground.com/#markup=DwEwlgbgfAEgpgGwQe2AenNIA"
`;

exports[`getByText query will throw the custom error returned by config.getElementError 1`] = `"My custom error: Unable to find an element with the text: TEST QUERY. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible."`;
Loading