Skip to content

Build mocha tests as esmodule / .mjs #7115

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

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
- Move `ounit_tests` into the `tests` folder. https://github.com/rescript-lang/rescript-compiler/pull/7096
- 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
- Capitalize runtime filenames. https://github.com/rescript-lang/rescript-compiler/pull/7110
- Build mocha tests as esmodule / .mjs. https://github.com/rescript-lang/rescript-compiler/pull/7115

# 12.0.0-alpha.3

Expand Down
1 change: 0 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"ignore": [
"tests/build_tests/**",
"tests/tests/**",
"tests/tests_esmodule/**",
"lib/**",
"ninja/**",
"playground/**",
Expand Down
7 changes: 1 addition & 6 deletions scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,7 @@ async function runTests() {
stdio: [0, 1, 2],
});

cp.execSync(rescript_exe, {
cwd: path.join(__dirname, "..", "tests/tests_esmodule"),
stdio: [0, 1, 2],
});

cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.js`, {
cp.execSync(`npx mocha -t 10000 tests/tests/**/*_test.mjs`, {
cwd: path.join(__dirname, ".."),
stdio: [0, 1, 2],
});
Expand Down
5 changes: 3 additions & 2 deletions tests/tests/rescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
}
],
"package-specs": {
"module": "commonjs",
"in-source": true
"module": "esmodule",
"in-source": true,
"suffix": ".mjs"
},
"bsc-flags": [
"-w -3-6-26-27-29-30-32..40-44-45-52-60-9-106+104",
Expand Down
26 changes: 0 additions & 26 deletions tests/tests/src/AsInUncurriedExternals.js

This file was deleted.

27 changes: 27 additions & 0 deletions tests/tests/src/AsInUncurriedExternals.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Generated by ReScript, PLEASE EDIT WITH CARE


function mo(prim0, prim1) {
return {
objectMode: false,
name: prim0,
someOther: true
};
}

let options = {
objectMode: false,
name: "foo",
someOther: true
};

function shouldNotFail(objectMode, name) {
return 3;
}

export {
mo,
options,
shouldNotFail,
}
/* No side effect */
16 changes: 0 additions & 16 deletions tests/tests/src/Coercion.js

This file was deleted.

17 changes: 17 additions & 0 deletions tests/tests/src/Coercion.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Generated by ReScript, PLEASE EDIT WITH CARE


function foo(x) {
return x;
}

let x = 1;

let xx = 1;

export {
x,
xx,
foo,
}
/* No side effect */
56 changes: 0 additions & 56 deletions tests/tests/src/DerivingAccessorsCurried.js

This file was deleted.

57 changes: 57 additions & 0 deletions tests/tests/src/DerivingAccessorsCurried.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Generated by ReScript, PLEASE EDIT WITH CARE


function myField(param) {
return param.myField;
}

function num(param_0) {
return {
TAG: "Num",
_0: param_0
};
}

function doubleNum(param_0, param_1) {
return {
TAG: "DoubleNum",
_0: param_0,
_1: param_1
};
}

function compose(a, accessor) {
return accessor(a);
}

let _composedMyField = 1;

let _composedNum = {
TAG: "Num",
_0: 1
};

let noParam = "NoParam";

let _myFieldAlias = myField;

let _noParamAlias = "NoParam";

let _numAlias = num;

let _doubleNumAlias = doubleNum;

export {
myField,
noParam,
num,
doubleNum,
_myFieldAlias,
_noParamAlias,
_numAlias,
_doubleNumAlias,
compose,
_composedMyField,
_composedNum,
}
/* No side effect */
56 changes: 0 additions & 56 deletions tests/tests/src/DerivingAccessorsUncurried.js

This file was deleted.

57 changes: 57 additions & 0 deletions tests/tests/src/DerivingAccessorsUncurried.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Generated by ReScript, PLEASE EDIT WITH CARE


function myField(param) {
return param.myField;
}

function num(param_0) {
return {
TAG: "Num",
_0: param_0
};
}

function doubleNum(param_0, param_1) {
return {
TAG: "DoubleNum",
_0: param_0,
_1: param_1
};
}

function compose(a, accessor) {
return accessor(a);
}

let _composedMyField = 1;

let _composedNum = {
TAG: "Num",
_0: 1
};

let noParam = "NoParam";

let _myFieldAlias = myField;

let _noParamAlias = "NoParam";

let _numAlias = num;

let _doubleNumAlias = doubleNum;

export {
myField,
noParam,
num,
doubleNum,
_myFieldAlias,
_noParamAlias,
_numAlias,
_doubleNumAlias,
compose,
_composedMyField,
_composedNum,
}
/* No side effect */
16 changes: 0 additions & 16 deletions tests/tests/src/DictInference.js

This file was deleted.

17 changes: 17 additions & 0 deletions tests/tests/src/DictInference.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Generated by ReScript, PLEASE EDIT WITH CARE

import * as Js_dict from "rescript/lib/es6/Js_dict.js";

let dict = {};

dict["someKey1"] = 1;

dict["someKey2"] = 2;

let asArray = Js_dict.values(dict);

export {
dict,
asArray,
}
/* Not a pure module */
Loading