Plumeria 19.9
Plumeria v19.9 adds @plumeria/swc-jest. Components can now be tested in Jest as well as Vitest.
1. @plumeria/swc-jest
@plumeria/core ships types and no runtime, so a component test only works when the runner compiles the styling prop away first. Vitest did that through @plumeria/unplugin. Jest had no transformer for it.
@plumeria/swc-jest compiles the file, then hands it to @swc/jest. Put it where @swc/jest was:
module.exports = {
testEnvironment: 'jsdom',
transform: {
'^.+\\.(t|j)sx?$': '@plumeria/swc-jest',
},
};SWC is configured as before, from .swcrc or from the options next to the transformer. styleProp, withoutLogicalProperties and withoutPhysicalProperties are read by Plumeria; every other key goes to @swc/jest.
Styles imported from another file compile as they do in the build, and Jest's cache follows them: change a shared style and the files that use it are compiled again.
A project on ts-jest, babel-jest or next/jest moves that entry to @plumeria/swc-jest. See @plumeria/swc-jest and Testing.