1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-09-30 16:00:46 +00:00
TiddlyWiki5/plugins/tiddlywiki/jasmine
Jeremy Ruston ece8b0ee01
Add <$testcase> widget (#7817)
* Initial Commit

* Add note to preview build

* Fix whitespace and indenting

Thanks @pmario

* Fix crash with unset $tiddler attribute on <$data> widget

Thanks @CodaCodr

* Don't duplicate "description" field in test cases

* Use different background colours for nested testcase widgets

* Extend the testcase widget to run tests

* Add testcases to control panel

* Add a view template body template to render testcase tiddlers

* Test edition should display testcases

* Whitespace fixes

* Make testcase tiddler tempalte link to itself

* Styling tweaks

* Docs improvements

* Styling tweaks

* Run the new tw5.com testcases in the test edition

* Update data widget to display its content in JSON

* Add testcase convenience procedure

* Clearer testcases for data widget, and docs tweaks

* Don't expect our intentionally failing test to pass

* Extend testcase default template so that the display format can be chosen

It is selected by setting the variable "displayFormat"

* DataWidget docs typo

* Fix data widget not refreshing

* Links in testcase output switch to the tab containing that tiddler

Thanks to @btheado for the suggestion

* Docs update for 648855e8a5

* Wording tweak

* Add support for narrative tiddlers in test cases

* Documentation improvements

* Cleanup comments

* Remove obsolete code comments

* Simplify template

* Docs update

* Rename $:/core/ui/testcases/DefaultTemplate/SourceTabs from $:/core/ui/testcases/DefaultTemplate/Source

* Use the view template body for failing tests

* Don't reference the geospatial plugin

* "Test case" should be two words

* Fix handling of currentTiddler variable

Fixes problem reported by @btheado in https://github.com/Jermolene/TiddlyWiki5/pull/7817#issuecomment-2103704468

* Prepare for merging
2024-05-20 11:30:30 +01:00
..
files Upgrade to Jasmine 3 (#4226) 2019-11-12 21:42:38 +00:00
command.js Jasmine command (#6944) 2022-11-20 17:54:18 +00:00
help.tid Jasmine command (#6944) 2022-11-20 17:54:18 +00:00
jasmine-plugin.js Fix comment missing from previous commit 6c7c21a87b 2023-07-06 12:01:39 +01:00
plugin.info Improve plugin metadata, and add a "name" field 2019-09-19 13:04:10 +01:00
readme.tid Jasmine command (#6944) 2022-11-20 17:54:18 +00:00
run-wiki-based-tests.js Add <$testcase> widget (#7817) 2024-05-20 11:30:30 +01:00
startup.js Fix overeager onload handler in Jasmine plugin 2023-07-06 11:52:33 +01:00
update-packages.sh Upgrade to Jasmine 3 (#4226) 2019-11-12 21:42:38 +00:00

title: $:/plugins/tiddlywiki/jasmine/readme

This plugin provides a framework for running tests in the browser and under Node.js. It is based on [[Jasmine|https://jasmine.github.io/]] test framework. On Tiddlywiki, it runs tests in all javascript tiddlers tagged with <<tag $:/tags/test-spec>>.

[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/jasmine]]

!! Usage on Node.js

On the command line, type `tiddlywiki --test`.

Alternatively, you can set up a build task for jasmine by including the following in your tiddlywiki.info file:

```
{
	...
	"build": {
		...
		"test": ["--test"]
	}
}
```

You could then run tests by typing `tiddlywiki --build test` or just `tiddlywiki --build`. The advantage to this is it allows you to include other commands to run as well. See `tiddlywiki --help test` for more information.

This will run the tests and produce a test file in your output directory.

```
		"test": [
			"--test",
			"--rendertiddler","$:/core/save/all","test.html","text/plain"]
```

!! Usage on a browser

Once you've constructed a Tiddlywiki file using a command like the one above, you can run the tests simply by opening it. Tests run automatically, and the results will be at the bottom of the window.