File tree Expand file tree Collapse file tree 1 file changed +43
-6
lines changed
Expand file tree Collapse file tree 1 file changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -161,18 +161,55 @@ samples/test-adaptor.js
161161samples/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 ` .
You can’t perform that action at this time.
0 commit comments