Skip to content

Conversation

GeoffreyBooth
Copy link
Member

No description provided.

@GeoffreyBooth GeoffreyBooth added the documentation Improvements or additions to documentation label Apr 4, 2022
@nicolo-ribaudo
Copy link

nicolo-ribaudo commented Apr 4, 2022

Uh note that it's not a loader, it just can be used with loaders to do some of the things that jest does by using the VM module.

@GeoffreyBooth
Copy link
Member Author

Uh note that it’s not a loader, it just can be used with loaders to do some of the things that jest does by using the VM module.

That’s fine, this is a list of “related projects,” not a list of loaders.

Is there a high-level explanation for how it does what it does? It’s not using the loader API, I assume, so how does it add the Jest globals and do functional mocking and the other Jest features that it supports?

@nicolo-ribaudo
Copy link

nicolo-ribaudo commented Apr 4, 2022

Ok, to be more specific... It does nothing (that's why I initially replied to this issue, I don't know if it "fits" in this list). It just uses import() to load the test files, after attaching the Jest globals to globalThis.

Its relationship with loaders is just that its (short) documentation shows that you can replace some of the Jest features, that Jest implements with vm.Module, with some loaders (that already exists, they were created by other people and not specifically for jest-light-runner).

It might add more value to add the loaders its README mentions to this list (ts-node and esmock).

However, it might be helpful to mention this package next to the Jest tracking issue link near the end of this file, for people who want to quickly now how to have a fully-compatible ESM environment when using Jest.

@GeoffreyBooth
Copy link
Member Author

Thanks. I think it’s good to document how people are already solving some of the problems on our list, like mocking, because those existing solutions are things we very much want to be aware of as we continue to develop the loaders API.

@GeoffreyBooth GeoffreyBooth merged commit 1e4b58b into main Apr 6, 2022
@GeoffreyBooth GeoffreyBooth deleted the jest-light-runner branch April 6, 2022 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants