How to ignore Jasmine promises when "no-floating-promises" in tslint is true
Asked Answered
E

1

6

Is there a way to have "no-floating-promises" turned on but let it ignore Jasmine promises like "toEqual", "toBe", etc.? I want to use it, but it complains about my expect statements all over the place.

expect(1).toEqual(1)  // Would complain about this

For example: enter image description here

Eulogium answered 8/7, 2019 at 16:13 Comment(1)
update the question with you implementation and the complete error logSalamanca
T
3

I use void keyword for the jasmine expect. Although there is some discussion about how appropriate that is: https://github.com/palantir/tslint/issues/4653

void expect(1).toEqual(1)  // Would not complain about this
Temperament answered 8/11, 2019 at 14:39 Comment(1)
Works but don't like the solution since now every expect must be preceded by voidMoat

© 2022 - 2024 — McMap. All rights reserved.