Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
ejecutando casos de prueba de Cypress con aserción expect(xhr.requestBody.test).to.not.exist, pero eslint arroja un error
 cy.wait("api").then((xhr: any) => { expect(xhr.method).to.eq("POST"); expect(xhr.status).to.eq(200); expect(xhr.requestBody.test).to.not.exist; });

expect(xhr.requestBody.test).to.not.exist; esta línea arroja un error de eslint como se muestra a continuación:

 error Expected an assignment or function call and instead saw an expression @typescript-eslint/no-unused-expressions
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

En mi opinión tienes múltiples opciones para solucionar esto:

La primera y recomendada opción es reescribir su afirmación, por ejemplo, de la siguiente manera:

 const bodyContainsTest = xhr.requestBody.hasOwnProperty('test'); expect(bodyContainsTest).to.be.false;

La segunda opción sería simplemente deshabilitar esa regla para la siguiente línea:

 // eslint-disable-next-line @typescript-eslint/no-unused-expressions expect(xhr.requestBody.test).to.not.exist;

Otra opción sería deshabilitar esta regla globalmente para todos los archivos de prueba de Cypress en su .eslintrc.json si es necesario:

 "@typescript-eslint/no-unused-expressions": "off",
about 4 years ago · Juan Pablo Isaza Report

0

Verificado en tslint-playground .

Dos suplentes que pasan el linter:

 expect(xhr.requestBody).to.not.have.property(test) expect(xhr.requestBody.test).to.eq(undefined)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!