From 8e3ff03d698ff7fc2abdca7a04a9c842ef661f38 Mon Sep 17 00:00:00 2001 From: Stefano Magni Date: Fri, 1 Dec 2023 17:23:54 +0100 Subject: [PATCH] Fix typescript signature (#478) * chore: update to Node.js 20 * fix: fix waitUntil chained value type BREAKING CHANGE: TypeScript tests could now throw because of operations made on the value returned by `checkFunction` (passed to cy.waitUntil). The type was previously `undefined` while now reflecting the type returned by `checkFunction`. fix #477 --- .travis.yml | 2 +- cypress/types/plugin.spec.ts | 4 ++++ index.d.ts | 2 +- package-lock.json | 4 ++++ package.json | 4 ++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index f774a2f..d414867 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: node_js node_js: - - 10 + - 20 addons: apt: packages: diff --git a/cypress/types/plugin.spec.ts b/cypress/types/plugin.spec.ts index dd5418f..60e67ee 100644 --- a/cypress/types/plugin.spec.ts +++ b/cypress/types/plugin.spec.ts @@ -82,3 +82,7 @@ cy.wrap('').waitUntil((subject) => subject.length) cy.wrap('').waitUntil((subject) => !!subject.length) cy.wrap('').waitUntil((subject) => !!subject.length) cy.wrap('').waitUntil((subject) => subject.length) + +cy.waitUntil(() => cy.task('myTaskReturningANumber')).then((subject) => { + subject * subject +}) diff --git a/index.d.ts b/index.d.ts index 357b588..5526d3c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -26,6 +26,6 @@ declare namespace Cypress { subject: Subject | undefined ) => ReturnType | Chainable | Promise, options?: WaitUntilOptions - ): Chainable + ): Chainable } } diff --git a/package-lock.json b/package-lock.json index 076f5c6..2a86ab2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,10 @@ "serve": "14.2.0", "start-server-and-test": "2.0.0", "typescript": "5.0.4" + }, + "engines": { + "node": ">=20.1.0", + "npm": ">=9.6.4" } }, "node_modules/@babel/code-frame": { diff --git a/package.json b/package.json index 092aadb..d641df6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "name": "cypress-wait-until", "version": "2.0.1", + "engines" : { + "npm" : ">=9.6.4", + "node" : ">=20.1.0" + }, "description": "A waiting plugin for Cypress", "main": "src/index.js", "dependencies": {},