Skip to content

Commit 411b7b5

Browse files
authored
Build mocha tests as esmodule / .mjs (#7115)
* Build mocha tests as esmodule / .mjs * CHANGELOG
1 parent 1247e83 commit 411b7b5

File tree

1,202 files changed

+74599
-74102
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,202 files changed

+74599
-74102
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
- Move `ounit_tests` into the `tests` folder. https://github.com/rescript-lang/rescript-compiler/pull/7096
6363
- Move `syntax_tests` into the `tests` folder. https://github.com/rescript-lang/rescript-compiler/pull/7090 https://github.com/rescript-lang/rescript-compiler/pull/7097
6464
- Capitalize runtime filenames. https://github.com/rescript-lang/rescript-compiler/pull/7110
65+
- Build mocha tests as esmodule / .mjs. https://github.com/rescript-lang/rescript-compiler/pull/7115
6566

6667
# 12.0.0-alpha.3
6768

biome.json

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"ignore": [
2424
"tests/build_tests/**",
2525
"tests/tests/**",
26-
"tests/tests_esmodule/**",
2726
"lib/**",
2827
"ninja/**",
2928
"playground/**",

scripts/test.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ async function runTests() {
6565
stdio: [0, 1, 2],
6666
});
6767

68-
cp.execSync(rescript_exe, {
69-
cwd: path.join(__dirname, "..", "tests/tests_esmodule"),
70-
stdio: [0, 1, 2],
71-
});
72-
73-
cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.js`, {
68+
cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.mjs`, {
7469
cwd: path.join(__dirname, ".."),
7570
stdio: [0, 1, 2],
7671
});

tests/tests/rescript.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
}
88
],
99
"package-specs": {
10-
"module": "commonjs",
11-
"in-source": true
10+
"module": "esmodule",
11+
"in-source": true,
12+
"suffix": ".mjs"
1213
},
1314
"bsc-flags": [
1415
"-w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104",

tests/tests/src/AsInUncurriedExternals.js

-26
This file was deleted.
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
4+
function mo(prim0, prim1) {
5+
return {
6+
objectMode: false,
7+
name: prim0,
8+
someOther: true
9+
};
10+
}
11+
12+
let options = {
13+
objectMode: false,
14+
name: "foo",
15+
someOther: true
16+
};
17+
18+
function shouldNotFail(objectMode, name) {
19+
return 3;
20+
}
21+
22+
export {
23+
mo,
24+
options,
25+
shouldNotFail,
26+
}
27+
/* No side effect */

tests/tests/src/Coercion.js

-16
This file was deleted.

tests/tests/src/Coercion.mjs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
4+
function foo(x) {
5+
return x;
6+
}
7+
8+
let x = 1;
9+
10+
let xx = 1;
11+
12+
export {
13+
x,
14+
xx,
15+
foo,
16+
}
17+
/* No side effect */

tests/tests/src/DerivingAccessorsCurried.js

-56
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
4+
function myField(param) {
5+
return param.myField;
6+
}
7+
8+
function num(param_0) {
9+
return {
10+
TAG: "Num",
11+
_0: param_0
12+
};
13+
}
14+
15+
function doubleNum(param_0, param_1) {
16+
return {
17+
TAG: "DoubleNum",
18+
_0: param_0,
19+
_1: param_1
20+
};
21+
}
22+
23+
function compose(a, accessor) {
24+
return accessor(a);
25+
}
26+
27+
let _composedMyField = 1;
28+
29+
let _composedNum = {
30+
TAG: "Num",
31+
_0: 1
32+
};
33+
34+
let noParam = "NoParam";
35+
36+
let _myFieldAlias = myField;
37+
38+
let _noParamAlias = "NoParam";
39+
40+
let _numAlias = num;
41+
42+
let _doubleNumAlias = doubleNum;
43+
44+
export {
45+
myField,
46+
noParam,
47+
num,
48+
doubleNum,
49+
_myFieldAlias,
50+
_noParamAlias,
51+
_numAlias,
52+
_doubleNumAlias,
53+
compose,
54+
_composedMyField,
55+
_composedNum,
56+
}
57+
/* No side effect */

tests/tests/src/DerivingAccessorsUncurried.js

-56
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
4+
function myField(param) {
5+
return param.myField;
6+
}
7+
8+
function num(param_0) {
9+
return {
10+
TAG: "Num",
11+
_0: param_0
12+
};
13+
}
14+
15+
function doubleNum(param_0, param_1) {
16+
return {
17+
TAG: "DoubleNum",
18+
_0: param_0,
19+
_1: param_1
20+
};
21+
}
22+
23+
function compose(a, accessor) {
24+
return accessor(a);
25+
}
26+
27+
let _composedMyField = 1;
28+
29+
let _composedNum = {
30+
TAG: "Num",
31+
_0: 1
32+
};
33+
34+
let noParam = "NoParam";
35+
36+
let _myFieldAlias = myField;
37+
38+
let _noParamAlias = "NoParam";
39+
40+
let _numAlias = num;
41+
42+
let _doubleNumAlias = doubleNum;
43+
44+
export {
45+
myField,
46+
noParam,
47+
num,
48+
doubleNum,
49+
_myFieldAlias,
50+
_noParamAlias,
51+
_numAlias,
52+
_doubleNumAlias,
53+
compose,
54+
_composedMyField,
55+
_composedNum,
56+
}
57+
/* No side effect */

tests/tests/src/DictInference.js

-16
This file was deleted.

tests/tests/src/DictInference.mjs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Generated by ReScript, PLEASE EDIT WITH CARE
2+
3+
import * as Js_dict from "rescript/lib/es6/Js_dict.js";
4+
5+
let dict = {};
6+
7+
dict["someKey1"] = 1;
8+
9+
dict["someKey2"] = 2;
10+
11+
let asArray = Js_dict.values(dict);
12+
13+
export {
14+
dict,
15+
asArray,
16+
}
17+
/* Not a pure module */

0 commit comments

Comments
 (0)