You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+7-8
Original file line number
Diff line number
Diff line change
@@ -176,7 +176,7 @@ The goal is to implement the runtime **purely in OCaml**. This includes removing
176
176
177
177
Each new PR should include appropriate testing.
178
178
179
-
Currently all tests are located in the `jscomp/test` directory and you should either add / update test files according to your changes to the compiler.
179
+
Currently all tests are located in the `tests/tests` directory and you should either add / update test files according to your changes to the compiler.
180
180
181
181
There are currently two formats for test files:
182
182
@@ -187,8 +187,8 @@ Below we will discuss on how to write, build and run these test files.
187
187
188
188
### 1) Write a Mocha Test File
189
189
190
-
- Create a file `jscomp/test/feature_abc_test.res`. Make sure to end the file name with `_test.res`.
191
-
- Inside the file, add a mocha test suite. The mocha bindings are defined in `jscomp/test/mt.res`. To get you started, here is a simple scaffold for a test suite with multiple test cases:
190
+
- Create a file `tests/tests/src/feature_abc_test.res`. Make sure to end the file name with `_test.res`.
191
+
- Inside the file, add a mocha test suite. The mocha bindings are defined in `tests/tests/src/mt.res`. To get you started, here is a simple scaffold for a test suite with multiple test cases:
192
192
193
193
```rescript
194
194
let suites: Mt.pair_suites = list{
@@ -201,16 +201,15 @@ Below we will discuss on how to write, build and run these test files.
201
201
Mt.from_pair_suites(__MODULE__, suites)
202
202
```
203
203
204
-
- Build the test files: `node scripts/ninja.js clean && node scripts/ninja.js build`.
205
-
- Run the tests: `npx mocha jscomp/test/**/*test.js`.
204
+
- Build the test files and run the tests: `node scripts/test.js -mocha`.
206
205
207
206
### 2) Write a Plain `.res` Test File
208
207
209
208
This is usually the file you want to create to test certain compile behavior without running the JS code formally as a test, i.e., when you just want to check that the ReScript code compiles and produces the expected JS code.
210
209
211
-
- Create your test file `jscomp/test/my_file_test.res`. Make sure to end the file name with `_test.res`.
- Verify the output, check in the `jscomp/test/my_file_test.res` and `jscomp/test/my_file_test.js` to version control. The checked in `.js` file is essential for verifying regressions later on.
210
+
- Create your test file `tests/tests/src/my_file_test.res`. Make sure to end the file name with `_test.res`.
211
+
- Build the `.js` artifact: `node scripts/test.js -mocha`.
212
+
- Verify the output, check in the `tests/tests/src/my_file_test.res` and `tests/tests/src/my_file_test.js` to version control. The checked in `.js` file is essential for verifying regressions later on.
214
213
- Eventually check in other relevant files changed during the rebuild (depends on your compiler changes).
0 commit comments