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

Compatibility with Jest 28 #239

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Compatibility with Jest 28 #239

wants to merge 3 commits into from

Conversation

thet
Copy link

@thet thet commented Apr 29, 2022

Breaks compatibility with Jest < 27, most probably (Didn't test that).

@fregante
Copy link

fregante commented May 3, 2022

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;
};

Therefore this isn't a breaking change for Jest 27 users. @keplersj I hope to see this merged soon.

thet added a commit to Patternslib/Patterns that referenced this pull request May 3, 2022
Remove jest-raw-loader dependency and add own loader based on keplersj/jest-raw-loader#239 for compatibility with Jest 28.
@thet
Copy link
Author

thet commented May 3, 2022

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),
        };
    },
};

@fregante
Copy link

fregante commented May 3, 2022

Indeed it's easier to just drop the dependency

max-nextcloud added a commit to nextcloud/text that referenced this pull request May 5, 2022
It does not work with jest 28 until
keplersj/jest-raw-loader#239.

Signed-off-by: Max <[email protected]>
thet added a commit to Patternslib/Patterns that referenced this pull request May 16, 2022
Remove jest-raw-loader dependency and add own loader based on keplersj/jest-raw-loader#239 for compatibility with Jest 28.
thet added a commit to Patternslib/Patterns that referenced this pull request May 16, 2022
Remove jest-raw-loader dependency and add own loader based on keplersj/jest-raw-loader#239 for compatibility with Jest 28.
@glensc
Copy link

glensc commented Jul 22, 2022

Without this merged people will be abandoning this package and just do the copy/paste fix in their project:

@glensc
Copy link

glensc commented Sep 22, 2022

perhaps merge and release this with 2.0.0 version already?

@glensc
Copy link

glensc commented Sep 22, 2022

this also works:

yarn add --dev keplersj/jest-raw-loader#pull/239/head

refs:

@glensc
Copy link

glensc commented Nov 23, 2022

jest was bumped in f77f13b, 98ecf9a, e70ca62, dfc5fc8. I guess the CI doesn't actually test that the loader works and merges with broken deps.

glensc added a commit to glensc/jest-raw-loader that referenced this pull request Nov 23, 2022
@glensc
Copy link

glensc commented Nov 23, 2022

Merged this to my fork:

I plan to release it in npm. stay tuned.

@glensc
Copy link

glensc commented Nov 23, 2022

Published as @glen/[email protected]

@sneko
Copy link

sneko commented Nov 6, 2024

@glensc I cannot comment onto your archived repo, maybe you could just precise the workaround to still keep using your realase: #430 (comment)

Thanks again for your work, I used it for years, and still!

@glensc
Copy link

glensc commented Nov 8, 2024

@sneko: unarchived. send a PR?

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

Successfully merging this pull request may close these issues.

4 participants