feat: inline constant tag transformation #200
Annotations
4 errors
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts > jsx with dynamic Component tag:
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts#L153
AssertionError: expected 'function fn() {\n return React.creat…' to deeply equal 'function fn() {\n const Component = …'
- Expected
+ Received
function fn() {
- const Component = r ? "a" : "div";
- return <div>Hello</div>;
+ return React.createElement(
+ r ? "a" : "div",
+ null,
+ "Hello",
+ );
}
❯ packages/unminify/src/transformations/__tests__/un-jsx.spec.ts:153:1
❯ packages/test-utils/src/index.ts:32:22
|
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts > jsx with dynamic Component tag #2:
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts#L171
AssertionError: expected 'function fn() {\n return React.creat…' to deeply equal 'function fn() {\n const Component = …'
- Expected
+ Received
function fn() {
- const Component = components[0];
- return <Component>Hello</Component>;
+ return React.createElement(
+ components[0],
+ null,
+ "Hello",
+ );
}
❯ packages/unminify/src/transformations/__tests__/un-jsx.spec.ts:171:1
❯ packages/test-utils/src/index.ts:32:22
|
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts > jsx with dynamic Component tag #3:
packages/unminify/src/transformations/__tests__/un-jsx.spec.ts#L189
AssertionError: expected 'const Foo = () => {\n return jsxs("d…' to deeply equal 'const Foo = () => {\n const Componen…'
- Expected
+ Received
const Foo = () => {
- const Component = g ? "p" : "div";
- const Component_1 = r ? "a" : "div";
- return <div><Component_1 key="b">bar</Component_1><Component key={c}>baz</Component></div>;
+ return jsxs("div", {
+ children: [
+ jsx(r ? "a" : "div", { children: "bar" }, "b"),
+ jsx(g ? "p" : "div", { children: "baz" }, c),
+ ]
+ });
};
❯ packages/unminify/src/transformations/__tests__/un-jsx.spec.ts:189:1
❯ packages/test-utils/src/index.ts:32:22
|
check
Process completed with exit code 1.
|