Skip to content

Commit 848b3ab

Browse files
committed
Don't run with mocha
1 parent f104529 commit 848b3ab

File tree

4 files changed

+122
-352
lines changed

4 files changed

+122
-352
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
"@biomejs/biome": "1.9.4",
8686
"@types/node": "^20.14.9",
8787
"@types/semver": "^7.5.8",
88-
"esbuild": "0.25.3",
8988
"mocha": "10.8.2",
9089
"nyc": "15.0.0",
9190
"semver": "7.6.2",

scripts/test.js

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import * as fs from "node:fs";
44
import * as os from "node:os";
55
import * as path from "node:path";
6-
import * as esbuild from "esbuild";
76
import {
87
buildTestDir,
98
compilerTestDir,
@@ -84,38 +83,22 @@ if (mochaTest) {
8483
stdio: "inherit",
8584
});
8685

87-
// We need to the jsx because mocha doesn't support jsx
88-
const preserveJsxTestFile = path.join(
89-
projectDir,
90-
"tests/tests/src/preserve_jsx_test.mjs",
86+
await mocha(
87+
[
88+
"-t",
89+
"10000",
90+
"tests/tests/**/*_test.mjs",
91+
// Ignore the preserve_jsx_test.mjs file.
92+
// I can't run because Mocha doesn't support jsx.
93+
// We also want to keep the output as is.
94+
"--ignore",
95+
"tests/tests/src/preserve_jsx_test.mjs",
96+
],
97+
{
98+
cwd: projectDir,
99+
stdio: "inherit",
100+
},
91101
);
92-
try {
93-
await esbuild.build({
94-
entryPoints: [preserveJsxTestFile], // Specify the single input file
95-
outfile: preserveJsxTestFile, // Specify the single output file
96-
allowOverwrite: true, // We just overwrite the existing file
97-
bundle: false, // Crucial: Turn off bundling
98-
minify: false, // Turn off minification
99-
sourcemap: false, // Turn off source maps if not needed
100-
loader: { ".mjs": "jsx" }, // Tell esbuild to apply the 'jsx' loader to .mjs files
101-
format: "esm", // Ensure output is ESM
102-
platform: "node", // Target Node.js environment
103-
jsx: "automatic",
104-
});
105-
106-
console.log(`Built (transformed) ${preserveJsxTestFile}`);
107-
} catch (error) {
108-
console.error(
109-
`Error building (transforming) ${preserveJsxTestFile}:`,
110-
error,
111-
);
112-
process.exit(1);
113-
}
114-
115-
await mocha(["-t", "10000", "tests/tests/**/*_test.mjs"], {
116-
cwd: projectDir,
117-
stdio: "inherit",
118-
});
119102

120103
await node("tests/tests/src/core/Core_TestSuite.mjs", [], {
121104
cwd: projectDir,
Lines changed: 107 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,137 @@
1-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
23
import * as Primitive_option from "rescript/lib/es6/Primitive_option.js";
34
import * as JsxRuntime from "react/jsx-runtime";
5+
46
let React = {};
7+
58
let ReactDOM = {};
9+
610
function Preserve_jsx_test$Icon(props) {
7-
return /* @__PURE__ */ jsx("strong", {});
11+
return <strong/>;
812
}
13+
914
let Icon = {
1015
make: Preserve_jsx_test$Icon
1116
};
12-
let _single_element_child = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h1", { children: "Hello, world!" }) });
13-
let _multiple_element_children = /* @__PURE__ */ jsxs("div", { children: [
14-
/* @__PURE__ */ jsx("h1", { children: "Hello, world!" }),
15-
/* @__PURE__ */ jsx(Preserve_jsx_test$Icon, {})
16-
] });
17-
let _single_element_fragment = /* @__PURE__ */ jsx(Fragment, { children: Primitive_option.some(/* @__PURE__ */ jsx("input", {})) });
18-
let _multiple_element_fragment = /* @__PURE__ */ jsxs(Fragment, { children: [
19-
/* @__PURE__ */ jsx("input", { type: "text" }),
20-
/* @__PURE__ */ jsx("input", { type: "number" })
21-
] });
22-
let _unary_element_with_props = /* @__PURE__ */ jsx("input", { className: "foo", type: "text" });
23-
let _container_element_with_props_and_children = /* @__PURE__ */ jsx("div", { className: "foo", title: "foo", children: "Hello, world!" });
17+
18+
let _single_element_child = <div>
19+
<h1>
20+
{"Hello, world!"}
21+
</h1>
22+
</div>;
23+
24+
let _multiple_element_children = <div>
25+
<h1>
26+
{"Hello, world!"}
27+
</h1>
28+
<Preserve_jsx_test$Icon/>
29+
</div>;
30+
31+
let _single_element_fragment = <>
32+
{Primitive_option.some(<input/>)}
33+
</>;
34+
35+
let _multiple_element_fragment = <>
36+
<input type={"text"}/>
37+
<input type={"number"}/>
38+
</>;
39+
40+
let _unary_element_with_props = <input className={"foo"} type={"text"}/>;
41+
42+
let _container_element_with_props_and_children = <div className={"foo"} title={"foo"}>
43+
{"Hello, world!"}
44+
</div>;
45+
2446
let baseProps = {
2547
className: "foo",
2648
title: "foo"
2749
};
28-
let newrecord = { ...baseProps };
29-
let _unary_element_with_spread_props = /* @__PURE__ */ jsx("input", { ...newrecord, type: "text" });
30-
let newrecord$1 = { ...baseProps };
31-
let _container_with_spread_props = /* @__PURE__ */ jsxs("div", { ...newrecord$1, title: "barry", className: "barry", children: [
32-
"Hello, world!",
33-
/* @__PURE__ */ jsx("input", { type: "text" })
34-
] });
50+
51+
let newrecord = {...baseProps};
52+
53+
let _unary_element_with_spread_props = <input {...newrecord} type={"text"}/>;
54+
55+
let newrecord$1 = {...baseProps};
56+
57+
let _container_with_spread_props = <div {...newrecord$1} title={"barry"} className={"barry"}>
58+
{"Hello, world!"}
59+
<input type={"text"}/>
60+
</div>;
61+
3562
let baseChildren = [
36-
/* @__PURE__ */ jsx("span", { children: "Hello, world!" }),
37-
/* @__PURE__ */ jsx("span", { children: "Hello, world!" })
63+
<span>
64+
{"Hello, world!"}
65+
</span>,
66+
<span>
67+
{"Hello, world!"}
68+
</span>
3869
];
39-
let _container_with_spread_children = /* @__PURE__ */ jsx("div", { className: "barry", title: "barry", children: baseChildren });
40-
let newrecord$2 = { ...baseProps };
41-
let _container_with_spread_props_and_children = /* @__PURE__ */ jsx("div", { ...newrecord$2, title: "barry", className: "barry", children: baseChildren });
42-
let newrecord$3 = { ...baseProps };
43-
let _unary_element_with_spread_props_keyed = /* @__PURE__ */ jsx("input", { ...newrecord$3, type: "text" }, "barry-key");
44-
let newrecord$4 = { ...baseProps };
45-
let _container_with_spread_props_keyed = /* @__PURE__ */ jsxs("div", { ...newrecord$4, title: "barry", className: "barry", children: [
46-
"Hello, world!",
47-
/* @__PURE__ */ jsx("input", { type: "text" })
48-
] }, "barry-key");
49-
let _unary_element_with_only_spread_props = /* @__PURE__ */ jsx("input", { ...baseProps });
50-
function QueryClientProvider(props) {
51-
return props.children;
52-
}
70+
71+
let _container_with_spread_children = <div className={"barry"} title={"barry"}>
72+
{baseChildren}
73+
</div>;
74+
75+
let newrecord$2 = {...baseProps};
76+
77+
let _container_with_spread_props_and_children = <div {...newrecord$2} title={"barry"} className={"barry"}>
78+
{baseChildren}
79+
</div>;
80+
81+
let newrecord$3 = {...baseProps};
82+
83+
let _unary_element_with_spread_props_keyed = <input key={"barry-key"} {...newrecord$3} type={"text"}/>;
84+
85+
let newrecord$4 = {...baseProps};
86+
87+
let _container_with_spread_props_keyed = <div key={"barry-key"} {...newrecord$4} title={"barry"} className={"barry"}>
88+
{"Hello, world!"}
89+
<input type={"text"}/>
90+
</div>;
91+
92+
let _unary_element_with_only_spread_props = <input {...baseProps} />;
93+
94+
function QueryClientProvider(props) { return props.children }
5395
;
96+
5497
let A = {};
98+
5599
function Preserve_jsx_test$B(props) {
56-
return /* @__PURE__ */ jsx("p", { children: "Hello, world!" });
100+
return <p>
101+
{"Hello, world!"}
102+
</p>;
57103
}
104+
58105
let B = {
59106
make: Preserve_jsx_test$B
60107
};
61-
let _external_component_with_children = /* @__PURE__ */ jsxs(QueryClientProvider, { children: [
62-
/* @__PURE__ */ jsx("strong", {}),
63-
/* @__PURE__ */ jsx(Preserve_jsx_test$B, {})
64-
] });
108+
109+
let _external_component_with_children = <QueryClientProvider>
110+
<strong/>
111+
<Preserve_jsx_test$B/>
112+
</QueryClientProvider>;
113+
65114
export {
66-
A,
67-
B,
68-
Icon,
69115
React,
70116
ReactDOM,
71-
_container_element_with_props_and_children,
72-
_container_with_spread_children,
73-
_container_with_spread_props,
74-
_container_with_spread_props_and_children,
75-
_container_with_spread_props_keyed,
76-
_external_component_with_children,
77-
_multiple_element_children,
78-
_multiple_element_fragment,
117+
Icon,
79118
_single_element_child,
119+
_multiple_element_children,
80120
_single_element_fragment,
81-
_unary_element_with_only_spread_props,
121+
_multiple_element_fragment,
82122
_unary_element_with_props,
123+
_container_element_with_props_and_children,
124+
baseProps,
83125
_unary_element_with_spread_props,
84-
_unary_element_with_spread_props_keyed,
126+
_container_with_spread_props,
85127
baseChildren,
86-
baseProps
87-
};
128+
_container_with_spread_children,
129+
_container_with_spread_props_and_children,
130+
_unary_element_with_spread_props_keyed,
131+
_container_with_spread_props_keyed,
132+
_unary_element_with_only_spread_props,
133+
A,
134+
B,
135+
_external_component_with_children,
136+
}
137+
/* _single_element_child Not a pure module */

0 commit comments

Comments
 (0)