-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@loopback/testlab requires mocha, conflicts with @types/jest if @types/mocha is brought in #2452
Comments
Hi @vazexqi, thank you for raising this issue. Is the problem still relevant? Did you manage to find any workaround?
That's a good question! To be honest, I haven't considered this aspect before. I think ideally, I'd like the helper to support different test runners. On Mocha, we want to call I think we should rework the helper into a factory accepting import {createSkippedOnTravis} from '@loopback/testlab';
// Mocha
const itSkippedOnTravis = createSkippedOnTravis(it);
// Jest
const itSkippedOnTravis = createSkippedOnTravis(test); What do you think? On an unrelated note, I am experimenting with migrating loopback-next from Mocha to Jest (with ts-jest plugin to compile TS files on the fly). One of the problems I have discovered is that Reflection does not seem to work in such setup, have you encountered this problem yourself too? |
I opened #3013 to fix the problem. |
@bajtos do we have any documentation on how to use jest with testlab in LoopBack? I am kind of intrigued to try this suite. |
@samarpanB testlab should be agnostic to the test runner used. Just replace mocha (and lb-mocha) with jest. You can find Jest configuration for loopback-next that I am experimenting with here: https://github.com/strongloop/loopback-next/tree/test/jest, see jest.config in particular. Please note that I'd like to improve BTW I am usually ignoring comments in closed issues and pull request. Please open a new issue if you would like to continue in this dicussion. |
Description / Steps to reproduce / Feature proposal
I would like to use jest instead of mocha as my testing framework. At the same time, I would also like to use @loopback/testlab for some of its convenience functions.
However, the current version @loopback/testlab requires mocha's type definition to be available. Specifically, this is in https://github.com/strongloop/loopback-next/blob/master/packages/testlab/src/skip-travis.ts
Current Behavior
If I don't bring in @types/mocha, I get the following error:
If I bring in @types/mocha, I get the following error:
Expected Behavior
I would like to be able to use @loopback/testlab without it referencing mocha.
Is this working-as-design (WAD)? I am not sure how tightly coupled @loopback/testlab wants to be to mocha since it's not declared explicitly in https://github.com/strongloop/loopback-next/blob/master/packages/testlab/package.json. It's part of a transitive dependency on @loopback/build.
The text was updated successfully, but these errors were encountered: