Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Document how to use w/ jest #33

Open
G-Rath opened this issue Nov 7, 2019 · 2 comments
Open

Document how to use w/ jest #33

G-Rath opened this issue Nov 7, 2019 · 2 comments

Comments

@G-Rath
Copy link

G-Rath commented Nov 7, 2019

I'm interested in using oclif in a jest project; ideally I'd like to use jest code as much as possible (i.e it & describe), but for now I'm looking into fancy-test to get going fast.

In the readme it says:

It should be compatible with other testing libraries as well (e.g. jest), but may require a couple small changes. If you're interested, try it out and let me know if it works.

But I can't find any evidence on how to get it working w/ jest.

I'm opening this issue for both assistance & as documentation, as I'll include details on how to go about it if I manage to get it working myself :)

@jorge0136
Copy link

jorge0136 commented Nov 13, 2019

I'd like to second the call for some jest experimentation. A bit of interesting context is the brief discussion that takes place around testing in the Future of Oclif presentation.

Here is someone's blog post where they are entirely reinventing the oclif testing wheel. I think they are fighting some problems that are already solved within fancy-test.

I think there are a few moving pieces here that need to be considered:

  • Should fancy-test continue to use the jquery like function chaining syntax in the long term? I think part of @G-Rath's ask here is a move away from the focus on function chaining. I too would prefer more of a rspec style.
  • Is it possible to support jest's specific setup and teardown needs alongside mocha's or do these need to be separate projects/ architectures? Doing a short search for mocha in the codebase most of the mocha specific implementation appears to be contained within src/base.ts and src/types.ts

@RTongue
Copy link

RTongue commented Sep 24, 2023

I recently discovered oclif and was also interested in using jest for testing as I have a lot of experience with jest and not as much with mocha/chai. After a lot of experimentation, I was able to get a minimal hello-world example working: https://github.com/RTongue/jest-test/tree/oclif-jest-test

TBD if this will work in more complex scenarios.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants