Skip to content
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

Mocha version #65

Closed
fatso83 opened this issue Aug 4, 2023 · 2 comments
Closed

Mocha version #65

fatso83 opened this issue Aug 4, 2023 · 2 comments

Comments

@fatso83
Copy link

fatso83 commented Aug 4, 2023

This module solves a problem that is recurring in many situations (and which also occurs in other bundlers). The essential changes seem to have nothing to do with Jest specifically, so would it be possible to modify the API to make it possible to using it with other test runners, like Ava or Mocha?

Typically, seeing something like this in .mocharc.json:

{
  "spec": ["src/**/*.{spec,test}.ts"],
  "require": ["@swc/register", "jest-mutable-exports"],
  "recursive": true
}
@magic-akari
Copy link
Owner

I think it should work out of the box. You can just put jest_workaround in the .swcrc configuration file.

I don't know the details about whether it can only work for mocha like jest.

For the issue you linked, there is another unsolvable issue:

@fatso83
Copy link
Author

fatso83 commented Aug 11, 2023

@magic-akari Thanks for that! I think the plugin should be renamed to something that has nothing to do with Jest. It really should be something like "plugin-swc-mutable-exports" (or whatever the naming convention for swc is).

I got it running though! https://github.com/fatso83/sinon-swc-bug/tree/swc-with-mutable-exports

The issue you talk about is that the exports are getters. Since these getters are actually writable/configurable, I just instructed Sinon to replace the getter.

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

No branches or pull requests

2 participants