We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When a module export a constant:
export const FOO = 3; export function getFoo() { return FOO; }
In Jest you can mock using:
jest.mock('./foo', () => { const { getFoo } = jest.requireActual('./foo'); return { FOO: 5, getFoo } })
This will not work correctl because SWC is not using the export constant but an internal constant in the module
test('should be mock', () => { expect(getFoo()).toBe(5); // Fail })
The transpile code looks like:
const FOO = 3 exports.FOO = FOO; exports.getFoo = function() { return FOO; // It should be exports.FOO in order to work. };
The text was updated successfully, but these errors were encountered:
This is not an issue of swc. See swc-project/swc#3843
Sorry, something went wrong.
No branches or pull requests
When a module export a constant:
In Jest you can mock using:
This will not work correctl because SWC is not using the export constant but an internal constant in the module
The transpile code looks like:
The text was updated successfully, but these errors were encountered: