Skip to content

Options

Randy Hunt edited this page Dec 23, 2013 · 4 revisions

The following options can be specified both as command-line options or as options in an rc file.

baseline

baseline is the directory in which baseline screen captures should be stored. (Default is /tmp/specter.)

diffdir

diffdir is the directory into which diff files are stored when a test fails. (Default is the same directory as the test js file.)

emptydiffs

emptydiffs causes Specter to clear the contents of the diff directory before it runs. Under normal behavior, old failure diffs would be kept in the directory in case you want to reference them. Specifying this option removes them.

failviewer

failviewer can contain a shell command into which to pass the paths of failure diffs. When tests fail, the paths to the failure diffs will be passed to this program after Specter finishes. This can be used to open the diffs in a viewer, or to send them out by email, or any other task else you can think of.

hostname

hostname specifies the hostname to use whenever relative paths are passed into the open() command, rather than absolute URLs. If no value is specified for hostname, relative URLs will be treated as local files in the filesystem, relative to the path of the test.

rebase

rebase tells Specter to capture new baseline images for all the tests currently being run. Use this flag on the test for the page you're working on when you want to update the expected test results to reflect a change you've just made.

testroot

testroot is the folder that contains all the test files to run. This folder is used as a reference in order to recreate your directory structure in the baseline and diff folders. (Default is the current working directory.)

Each option can be given on the command line:

specter --testroot=~/my/tests --baseline=~/my/baseline diffdir=~/my/diffs tests/*

(Note: if you add the rebase flag to a .specterrc file, Specter will just capture new baselines every time, never comparing screen captures to previously generated files. This is probably not the behavior you want.)

Specter follows standard .rc file behavior.

  • -Global defaults can be set in /etc/specterrc-
  • User-level settings can be set in ~/.specterrc
  • Project-level settings can be set within the project in a .specterrc file in the current working directory, or any directory above it.
$ cat .specterrc

[paths]
testroot = static/styles/tests
baseline = static/styles/screenshots
diffdir = /tmp/specter

[args]
emptydiffs

Please note that relative paths in .specterrc files are relative to that file.

v-0.2 note: the "specter" section in the rc files has been replaced by "paths" and "args" sections.