Skip to content

Commit 9340a83

Browse files
committed
Update documentation of tests.
1 parent 5f6e778 commit 9340a83

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

README.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,18 +161,55 @@ samples/test-adaptor.js
161161
samples/test-styles.js
162162
```
163163

164-
## Running TeX Parser Tests
164+
## Tests
165165

166-
You first need to install tape:
166+
All tests are located in the `./tests/` directory. We use
167+
[Jest](https://jestjs.io) as test framework.
168+
169+
### Running Tests
170+
171+
Just go to the `./tests/` directory and run the following two commands:
167172

168173
``` shell
169-
nmp install tape
174+
npm install
175+
npm test
170176
```
171177

172-
Then run tests with
178+
TeX parser tests in particular are run with the command:
173179

174180
``` shell
175-
./tests.sh
181+
npx jest src/parser.test.js
182+
```
183+
184+
To only test a single file run
185+
186+
``` shell
187+
npx jest src/parser.test.js json/FILE.json
188+
```
189+
190+
Tests initially run against `mathjax-full` package. They can be run against your
191+
local repository by rerouting the `js` and `es5` directories.
192+
193+
### Test Format
194+
195+
Tests are provided in a JSON test format.
196+
197+
198+
``` json
199+
{
200+
"name": NameOfTest,
201+
"factory": TestFactory,
202+
"tests": {
203+
"TEST1": {
204+
"input": INPUT
205+
"expected": EXPECTED
206+
...rest
207+
}
208+
...more tests
209+
}
210+
}
211+
176212
```
177213

178-
Tests are located in the `tests` sub-directory.
214+
To add new tests, simply add a new `.json` file in the `json` sub-directory. For
215+
new test classes add a new entry in `src/test-factory.js`.

0 commit comments

Comments
 (0)