2014-10-13 08:56:50 +00:00
modified: 20141013085608911
2014-09-11 19:12:25 +00:00
tags: Mechanisms
2013-04-25 17:01:48 +00:00
title: TestingMechanism
2013-04-25 16:55:59 +00:00
2023-06-11 09:36:02 +00:00
TiddlyWiki5 incorporates the Jasmine JavaScript testing framework (see https://jasmine.github.io/). It allows the same tests to be run both in the browser and under Node.js.
2013-04-25 16:55:59 +00:00
! TiddlyWiki5 Testing Components
There are two main elements to the TiddlyWiki5 testing mechanism:
2013-04-25 17:01:48 +00:00
2013-04-25 16:55:59 +00:00
* The plugin `tiddlywiki/jasmine` that wraps Jasmine up into a plugin along with some glue code
* The TiddlyWiki5 edition `test` that contains the core test specifications and includes the Jasmine plugin
2013-11-20 22:35:36 +00:00
! Running the Tests in Node.js
2013-04-25 16:55:59 +00:00
2013-11-20 22:35:36 +00:00
To run the tests under Node.js just load up the `test` wiki:
2013-04-25 16:55:59 +00:00
```
node ./tiddlywiki.js \
./editions/test \
```
! Running the Tests in the Browser
To generate a wiki containing the browser tests load up the `test` wiki and save it as an HTML file:
```
node ./tiddlywiki.js \
./editions/test \
--verbose \
2014-10-13 08:56:50 +00:00
--rendertiddler $:/core/save/all test.html text/plain \
2013-04-25 16:55:59 +00:00
```
2014-10-13 08:56:50 +00:00
The `test.html` file will be placed in the `output` folder within the wiki folder. Open it in the browser to see the test results. There is a prebuilt version of `test.html` at:
2013-04-25 16:55:59 +00:00
2017-11-11 11:56:20 +00:00
https://tiddlywiki.com/test.html