Compatibility with Jest 28
Breaks compatibility with Jest < 27, most probably (Didn't test that).
Breaks compatibility with Jest < 27
No, Jest 27 supported both strings and an object:
type TransformedSource =
| {code: string; map?: RawSourceMap | string | null}
| string;
While Jest 28 only dropped support for the raw string:
type TransformedSource = {
code: string;
map?: RawSourceMap | string | null;
};
- https://jestjs.io/docs/27.x/code-transformation
- https://jestjs.io/docs/code-transformation
Therefore this isn't a breaking change for Jest 27 users. @keplersj I hope to see this merged soon.
Btw, I currently solve it like so...
in jest.config.js:
module.exports = {
...
transform: {
"^.+\\.[t|j]sx?$": "babel-jest",
"\\.(html|xml|svg)$": "<rootDir>/jest-raw-loader.js",
},
};
in in jest-raw-loader.js:
// jest-raw-loader compatibility with Jest version 28.
// See: https://github.com/keplersj/jest-raw-loader/pull/239
module.exports = {
process: (content) => {
return {
code: "module.exports = " + JSON.stringify(content),
};
},
};
Indeed it's easier to just drop the dependency
Without this merged people will be abandoning this package and just do the copy/paste fix in their project:
- https://github.com/keplersj/jest-raw-loader/pull/239#issuecomment-1115799205
perhaps merge and release this with 2.0.0 version already?
- https://github.com/keplersj/jest-raw-loader/issues/249#issuecomment-1254915136
this also works:
yarn add --dev keplersj/jest-raw-loader#pull/239/head
refs:
- https://stackoverflow.com/questions/33181297/npm-install-from-github-pull-request
jest was bumped in f77f13b1, 98ecf9a5, e70ca623, dfc5fc82. I guess the CI doesn't actually test that the loader works and merges with broken deps.
Merged this to my fork:
- https://github.com/glensc/jest-raw-loader/commit/e7da211d8e02a31d7059e4fde39154080d96cae2
I plan to release it in npm. stay tuned.
Published as @glen/[email protected]