Skip to content

Commit 9aa0dee

Browse files
authored
feat: upgrade testcafe for 2.x support (#375) (#378)
BREAKING CHANGE: Upgrades testcafe to suppor 2.x and removes node 12.x support
1 parent c40acd5 commit 9aa0dee

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

.github/workflows/testcafe-testing-library.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
matrix:
1515
os: [ubuntu-latest]
16-
node: [12, 14, 16]
16+
node: [14, 16, 18]
1717
browser: ["chrome:headless", "firefox:headless"]
1818
steps:
1919
- uses: actions/setup-node@v3

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@
2222
"author": "",
2323
"license": "ISC",
2424
"dependencies": {
25-
"@testing-library/dom": "^7.27.1"
25+
"@testing-library/dom": "^8.19.0"
2626
},
2727
"peerDependencies": {
28-
"testcafe": ">= 1.5.0"
28+
"testcafe": ">=2.0.0"
2929
},
3030
"devDependencies": {
31-
"eslint": "^8.13.0",
32-
"eslint-config-prettier": "^8.1.0",
31+
"eslint": "^8.26.0",
32+
"eslint-config-prettier": "^8.5.0",
3333
"eslint-plugin-testcafe": "^0.2.1",
34-
"kcd-scripts": "^12.2.0",
34+
"kcd-scripts": "^12.3.0",
3535
"npm-run-all": "^4.1.5",
36-
"prettier": "^2.3.2",
37-
"semantic-release": "^19.0.2",
38-
"testcafe": "^1.8.4",
39-
"ts-jest": "^27.0.3",
40-
"typescript": "^4.0.2"
36+
"prettier": "^2.7.1",
37+
"semantic-release": "^19.0.5",
38+
"testcafe": ">=2.0.0",
39+
"ts-jest": "^29.0.3",
40+
"typescript": "^4.8.4"
4141
},
4242
"repository": {
4343
"type": "git",
4444
"url": "https://github.com/testing-library/testcafe-testing-library.git"
4545
},
4646
"engines": {
47-
"node": ">=12",
47+
"node": ">=14",
4848
"npm": ">=6"
4949
}
5050
}

src/index.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,9 @@ function isSelector(sel: SelectorArg): sel is Selector {
7676
return sel.constructor.name === SELECTOR_TYPE;
7777
}
7878

79-
const bindFunction = <
80-
T extends QueryName,
81-
MatcherOptions = Parameters<typeof queries[T]>[2]
82-
>(
83-
queryName: T
84-
) => {
79+
const bindFunction = <T extends QueryName>(queryName: T) => {
8580
const query = queryName.replace("find", "query") as T;
86-
return (matcher: Matcher, options?: MatcherOptions) => {
81+
return (matcher: Matcher, options?: Parameters<typeof queries[T]>[2]) => {
8782
return Selector(
8883
() =>
8984
window.TestingLibraryDom[query](document.body, matcher, options) as

tests/testcafe/selectors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ test("still works after browser page load", async (t) => {
7171
});
7272

7373
test("still works after reload", async (t) => {
74-
await t.eval(() => location.reload(true));
74+
await t.eval(() => location.reload());
7575
await t.expect(getByText("getByText").exists).ok();
7676
});

0 commit comments

Comments
 (0)