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
`scripts/ninja.js` will generate many `.ninja` build files inside the `jscomp` directory which will be invoked by `./scripts/ninja.js build`.
26
26
27
+
### Install JS tools
28
+
29
+
This is required to have all the necessary tools installed, such as the `mocha`
30
+
JS testing framework, etc.
31
+
32
+
```
33
+
npm install
34
+
```
35
+
27
36
### Editor support
28
37
29
38
Use this deprecated [VSCode extension](https://marketplace.visualstudio.com/items?itemName=hackwaly.ocaml).
@@ -123,35 +132,66 @@ cd ocaml && make -j9 world.opt && make install && cd ..
123
132
124
133
## Contributing to the runtime
125
134
126
-
BuckleScript runtime implementation is currently a mix of OCaml and JavaScript. (`jscomp/runtime` directory). The JavaScript code is defined in the `.ml` file using the `bs.raw` syntax extension.
135
+
BuckleScript runtime implementation is written in pure OCaml with some raw JS
136
+
code embedded (`jscomp/runtime` directory).
127
137
128
-
The goal is to implement the runtime **purely in OCaml** and you can help!
138
+
The goal is to implement the runtime **purely in OCaml**. This includes
139
+
removing all existing occurrences of embedded raw JS code as well, and you can
140
+
help!
129
141
130
142
Each new PR should include appropriate testing.
131
143
132
-
Currently all tests are in `jscomp/test` directory and you should either add/modify a test file which covers the part of the compiler you modified.
144
+
Currently all tests are located in the `jscomp/test` directory and you should
145
+
either add / update test files according to your changes to the compiler.
146
+
147
+
There are currently two formats for test files:
148
+
1. Proper mocha test files with executed javascript test code
149
+
2. Plain `.ml` files which are only supposed to be compiled to JS (without any logic validation)
133
150
134
-
- Add the filename in `jscomp/test/test.mllib`
135
-
- Add a test suite. The specification is in `jscomp/test/mt.ml`. For example some simple tests would be like:
151
+
Below we will discuss on how to write, build and run these test files.
152
+
153
+
### 1) Writing a mocha test file
154
+
155
+
- Create a file `jscomp/test/feature_abc_test.ml`. Make sure to end the file name with `_test.ml`.
156
+
- Inside the file, add a mocha test suite. The mocha bindings are defined in
157
+
`jscomp/test/mt.ml`. To get you started, here is a simple scaffold for a test
0 commit comments