@testing-library/cypress
Advanced tools
Comparing version 7.0.0-beta.1 to 7.0.0-beta.2
@@ -20,18 +20,8 @@ "use strict"; | ||
const queryNames = Object.keys(_dom.queries); | ||
const deprecatedRegex = /^(get|query)/; | ||
const findRegex = /^find/; | ||
const deprecatedQueryNames = queryNames.filter(q => deprecatedRegex.test(q)); | ||
const findQueryNames = queryNames.filter(q => findRegex.test(q)); | ||
const deprecatedCommands = deprecatedQueryNames.map(queryName => { | ||
return { | ||
name: queryName, | ||
command: () => { | ||
throw new Error(`You used '${queryName}' which has been removed from Cypress Testing Library because it does not make sense in this context. Please use '${queryName.replace(deprecatedRegex, 'find')}' instead.`); | ||
} | ||
}; | ||
}); | ||
const findCommands = findQueryNames.map(queryName => { | ||
const queryNames = Object.keys(_dom.queries).filter(q => findRegex.test(q)); | ||
const commands = queryNames.map(queryName => { | ||
return createCommand(queryName, queryName.replace(findRegex, 'get')); | ||
}); | ||
exports.commands = commands; | ||
@@ -183,8 +173,4 @@ function createCommand(queryName, implementationName) { | ||
} | ||
const commands = [...findCommands, ...deprecatedCommands]; | ||
/* eslint no-new-func:0, complexity:0 */ | ||
/* globals Cypress, cy */ | ||
exports.commands = commands; | ||
/* globals Cypress, cy */ |
{ | ||
"name": "@testing-library/cypress", | ||
"version": "7.0.0-beta.1", | ||
"version": "7.0.0-beta.2", | ||
"description": "Simple and complete custom Cypress commands and utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -61,3 +61,2 @@ <div align="center"> | ||
- [Installation](#installation) | ||
@@ -152,4 +151,7 @@ - [With TypeScript](#with-typescript) | ||
`get*` and `query*` queries are disabled. `find*` queries do not use the Promise | ||
API of `DOM Testing Library`, but instead forward to the `get*` queries and use | ||
`query*` queries are not supported. You should use the `should('not.exist') | ||
assertion instead to check for the absence of an element. | ||
`get*` queries are not supported. `find*` queries do not use the Promise API of | ||
`DOM Testing Library`, but instead forward to the `get*` queries and use | ||
Cypress' built-in retryability using error messages from `get*` APIs to forward | ||
@@ -156,0 +158,0 @@ as error messages if a query fails. |
309
43454
406