Skip to content

Commit fdc3e6c

Browse files
authored
Update documentation about tests (#7070)
1 parent 9178df2 commit fdc3e6c

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

CONTRIBUTING.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ The goal is to implement the runtime **purely in OCaml**. This includes removing
176176

177177
Each new PR should include appropriate testing.
178178

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.
180180

181181
There are currently two formats for test files:
182182

@@ -187,8 +187,8 @@ Below we will discuss on how to write, build and run these test files.
187187

188188
### 1) Write a Mocha Test File
189189

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:
192192

193193
```rescript
194194
let suites: Mt.pair_suites = list{
@@ -201,16 +201,15 @@ Below we will discuss on how to write, build and run these test files.
201201
Mt.from_pair_suites(__MODULE__, suites)
202202
```
203203

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`.
206205

207206
### 2) Write a Plain `.res` Test File
208207

209208
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.
210209

211-
- Create your test file `jscomp/test/my_file_test.res`. Make sure to end the file name with `_test.res`.
212-
- Build the `.js` artifact: `node scripts/ninja.js config && node scripts/ninja.js build`.
213-
- 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.
214213
- Eventually check in other relevant files changed during the rebuild (depends on your compiler changes).
215214

216215
## Contribute to the ReScript Playground Bundle

CREDITS.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ ReScript imported one file from [jsoo](https://github.com/ocsigen/js_of_ocaml)
4141

4242
This file was imported but changed significantly in iterations later.
4343

44-
- [`jscomp/test`](jscomp/test)
44+
- [`tests/tests`](tests/tests)
4545

46-
`jscomp/test` is based on [`ocaml/testsuite`](ocaml/testsuite).
46+
`tests/tests` is based on [`ocaml/testsuite`](ocaml/testsuite).
4747

4848
ReScript unit test builds on parts of [OUnit](http://ounit.forge.ocamlcore.org/)
4949

0 commit comments

Comments
 (0)