Closed mluk-sastrify closed 1 year ago
I'm using Cypress with Typescript, but when I am defining the variable with Cypress.env() command I am getting the following error in VSCode:
Cypress.env()
cypress.config.ts content:
cypress.config.ts
import { defineConfig } from 'cypress'; export default defineConfig({ e2e: { baseUrl: 'http://localhost:4040', env: { apiServerUrl: 'http://localhost:7777/api', }, setupNodeEvents(on, config) { // implement node event listeners here }, } });
spec example: cypress/e2e/example.cy.ts (as per Cypress docs: https://docs.cypress.io/api/cypress-api/env#No-Arguments):
cypress/e2e/example.cy.ts
const { apiServerUrl } = Cypress.env(); describe('GET', () => { it('should GET all subscriptions', () => { cy.api({ method: 'GET', url: `${apiServerUrl}/todo`, }).then(({ body, status }) => { expect(status).to.eq(200); expect(body).to.have.length(1); }); }); });
If I add a empty string in params the error goes away:
Seems to be related to: https://github.com/filiphric/cypress-plugin-api/issues/56
Thanks for the report! I just released the fix with version 2.10.1
Thanks, this is fixed now :)
I'm using Cypress with Typescript, but when I am defining the variable with
Cypress.env()
command I am getting the following error in VSCode:cypress.config.ts
content:spec example:
cypress/e2e/example.cy.ts
(as per Cypress docs: https://docs.cypress.io/api/cypress-api/env#No-Arguments):If I add a empty string in params the error goes away:
Seems to be related to: https://github.com/filiphric/cypress-plugin-api/issues/56