Permalink
Fetching contributors…
Cannot retrieve contributors at this time
53 lines (34 sloc) 2.36 KB
fixture
fixtures/path.js

Customising execution

Note: this page is a fully executable spec for the options it demonstrates. If you are reading this on GitHub, it will render the page nicely and hide all the technical details, so check out the raw markdown to see the actual test configuration.

You can customise the execution of an example by setting parameters in:

  • the command line -- to set a parameter for all examples in a test run
  • the YAML preamble of a markdown file -- for settings that apply to all examples on a particular page
  • the header of an individual example -- for settings that apply to a particular example

The order of precedence is example, page, command line, so you can override the generic values with more specific ones.

For a full list of parameters you can set, check out src/config/configurable-properties.js.

Check out the following documentation pages for more information on how individual parameters work:

You can also customise the format of the examples (JSON, YAML). For more information, check out the Formatting Examples guide.

In addition to using the standard parameters, you can define additional parameters on the page or in the example header, and they will be passed to your fixture. This is a way to provide a generic value to all examples on a page easily. Check out Passing parameters to fixtures for more information and an example.

In action

This whole page sets the fixture to fixtures/path.js in the preamble. Without any special overrides, that code will be used by default:

width: 100
height: 100
path: M10,10L90,90M90,10L10,90
color: green

green x

The following example sets the fixture to fixtures/circle.js in the fenced code block header, by using the fixture="<FIXTURE PATH>" parameter, so it will use a different piece of code to execute the test:

radius: 20
width: 50
height: 50
color: blue

blue circle