TiddlyWiki5/editions/dev/tiddlers/from tw5.com/mechanisms/TestingMechanism.tid

37 lines
1.1 KiB
Plaintext

modified: 20141013085608911
tags: Mechanisms
title: TestingMechanism
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.
! TiddlyWiki5 Testing Components
There are two main elements to the TiddlyWiki5 testing mechanism:
* 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
! Running the Tests in Node.js
To run the tests under Node.js just load up the `test` wiki:
```
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 \
--rendertiddler $:/core/save/all test.html text/plain \
```
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:
https://tiddlywiki.com/test.html