Skip to content

Commit

Permalink
Revert "build: remove targets - it should inherit the ones from brows…
Browse files Browse the repository at this point in the history
…erslist …"

This reverts commit 3897654.
  • Loading branch information
rivka-ungar authored Aug 12, 2024
1 parent c84a9ae commit b280655
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/core/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const TESTING_STORYBOOK = process.env.testing === "storybook";

module.exports = api => {
const env = process.env.NODE_ENV;
api.cache.using(() => env);
Expand Down Expand Up @@ -35,7 +37,18 @@ module.exports = api => {
[
"@babel/preset-env",
{
modules: env === "test" ? "commonjs" : false
modules: env === "test" ? "commonjs" : false,
targets: TESTING_STORYBOOK
? {
node: "current"
}
: {
chrome: "66",
ie: "11",
firefox: "51",
edge: "18",
node: "current"
}
}
],
"@babel/preset-typescript",
Expand Down
13 changes: 13 additions & 0 deletions packages/core/jest.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ Object.defineProperty(window, "matchMedia", {
});

ReactDOM.createPortal = node => node;
const { testing } = process.env;
const TESTING_STORYBOOK = testing === "storybook";

if (TESTING_STORYBOOK) {
jest.mock("react-transition-group", () => {
const FakeTransition = jest.fn(({ children }) => children);
const FakeCSSTransition = jest.fn(props => (props.in ? <FakeTransition>{props.children}</FakeTransition> : null));
return { CSSTransition: FakeCSSTransition, Transition: FakeTransition, SwitchTransition: FakeTransition };
});
jest.mock("consolidated-events", () => {
return { addEventListener: jest.fn() };
});
}

const error = console.error;
console.error = function (warning) {
Expand Down

0 comments on commit b280655

Please sign in to comment.