moll / js-must

An assertion library for JavaScript and Node.js with a friendly BDD syntax (awesome.must.be.true()). It ships with many expressive matchers and is test runner and framework agnostic. Follows RFC 2119 with its use of MUST. Good stuff and well tested.
Other
336 stars 35 forks source link

Typings seem to be wrong for main signature #75

Closed kpturner closed 3 years ago

kpturner commented 6 years ago

In must.d.ts shouldn't this:

declare function must(expected: any): Must;

actually be this:

declare function must(expected: any, msg?: string): Must;

otherwise how do we call must with the optional message parameter in Typescript?

chrisgedrim commented 6 years ago

76 fixes this issue

NicoleRauch commented 5 years ago

I keep struggling with this as well... Is there any news on it?

kpturner commented 5 years ago

Apparently fixed - see comments above yours

NicoleRauch commented 5 years ago

@kpturner Fixed in an open pull request - that is not too helpful for me tbh...

Will the PR be integrated and a new version be released at some point?

kpturner commented 5 years ago

I’ve no idea - it’s not my project. Try adding a comment to the PR to prompt the author to merge it or PM them directly.

NicoleRauch commented 5 years ago

Why do you close the issue then if it is not fixed?

kpturner commented 5 years ago

Because there is no point in having two issues open for the same thing.

kpturner commented 5 years ago

I will leave it open if you want to pursue it here rather than on the #76

NicoleRauch commented 5 years ago

For me a PR is not an issue, so in my own projects I prefer to track the issues. But I can understand your decision as well. So, feel free :-) I will move my comment over to the PR if you close this one.

moll commented 3 years ago

Thank you all for your help and attention! I've merged the tweak from @kpturner in and will release a new version shortly!

moll commented 3 years ago

Btw, if any of you have seen someone write automated tests for TypeScript typings, please let me know! I'd love to ensure the typings remain correct.

NicoleRauch commented 3 years ago

If you write some TypeScript code that uses js-must (i.e. some example tests written in TypeScript) and that is properly annotated with types, then the compiler will already flag any violations -- no need to run tests for this.

(Or am I misunderstanding what you're aiming at?)

EDIT: Most cases will probably even work sufficiently without type annotations. So you could in principle just use a demonstrator test suite for js-must and run it through the TypeScript compiler.

moll commented 3 years ago

I was thinking of a [test] file with a few well-typed uses per Must.js's assertion method and some ill-typed uses. Then running it through the typechecker along with other tests. :) I imagine the well-typed case is easy — running tsc --check or the equivalent and asserting it exits with 0. Testing for ill-typed uses probably won't be that easy. Dunno if it's actually worth the trouble to achieve though.

NicoleRauch commented 3 years ago

Testing for ill-typed uses probably won't be that easy. Dunno if it's actually worth the trouble to achieve though.

I was actually wondering about that one as well...

I (as a user) am more interested in being assured that js-must does not violate my TypeScript settings with its typings (e.g. no usage of "any") to be honest. So if your tests check for the well-typed stuff (with the TypeScript compiler settings being set to the strictest possible options), that would already be super-amazing!