1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00
TiddlyWiki5/plugins/tiddlywiki/jasmine
Arlen22 2b95daf59b
Change evalSandboxed to use only one context for all modules (#4624)
* Run modules in one new context

* Fix polyfill running on require

* Add code to check for global assignments

* Allow globals in separate context

This lets the caller request a separate context which may be polluted.

* Jasmine needs to pollute the global

* Formatting

* Add polyfill and cleanup code

* Convert to ES5

* One bug fix

* Some formatting

* Remove console.log line!

* Cleanup

* revert css-escape-polyfill.js to hopefully remove it from the PR

* Remove JSDOC directives
2023-05-06 12:11:18 +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 Change evalSandboxed to use only one context for all modules (#4624) 2023-05-06 12:11:18 +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 Introduce genesis widget (#6961) 2022-09-24 14:07:42 +01:00
startup.js Jasmine command (#6944) 2022-11-20 17:54:18 +00: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.