Overview
| Option | Default | Type | Description |
|---|---|---|---|
'testFramework' |
'jasmine' for browser and 'mocha' for node
|
|
Testing framework to run your tests with. |
'delays' |
It’s recommended to skip setting the property. |
Numeric delay property 'run' specifies the number of milliseconds to wait before letting wallaby.js automatically run your tests as a result of your code changes.
|
Delays to specify how much time wait before proceeding to the next stage of the automated test run workflow. |
'trace' |
'false' |
'boolean' |
If Debugging is |
'preserveComments' |
'false' |
'boolean' |
If Preserve Comments setting is |
'reportConsoleErrorAsError' |
'false' |
'boolean' |
If property Report console.error as test run error is |
'maxConsoleMessagesPerTest' |
100 | 'number' |
Set Maximum console messages logged per test to increase the limit of console messages logged per test. |
'slowTestThreshold' |
75 ms | 'number' |
Use setting slowTestThreshold to set the time above which the executed test duration is reported as slow. |
'runMode' |
'automatic' |
'onsave' | 'automatic' |
Please note: you may also need to change your editor settings to not save files automatically in order to use this feature, see Run Mode Setting |
'lowCoverageThreshold' |
80% | 'number' |
Use setting lowCoverageThreshold to set the value below which the coverage is reported as low. |
'name' |
Default project name | 'string' |
To change the displayed project name. |
'filesWithNoCoverageCalculated' |
the file name(s) | 'string' |
To exclude the file from code coverage calculation, and still be able to see its coverage indicators, inline errors and messages, etc., when it is opened. |
'reportUnhandledPromises' |
'boolean' |
'true' |
To change the behaviour when running in node.js environment, wallaby.js reports all unhandled promise rejections as errors, the Unhandled promise rejections setting should be set as |
'runAllTestsInAffectedTestFile' |
'boolean' |
if 'false', re-runs a minimal set of tests for a code change.
|
To run all tests in the test file every time when one/multiple test(s) of the file are affected by your code changes, the setting should be set as |
'ignoreFileLoadingDependencyTracking' |
'boolean' |
'false' |
To ignore file loading chains for files dependency tracking purposes, so that wallaby only re-runs tests that are directly using affected files exported functionality, the setting should be set as |
'maxLogEntrySize' |
'number' |
16,384 characters |
If the Maximum Log Entry Size setting is |
'screenshot' |
'boolean' |
'false' |
If you are running your tests using Chrome or PhantomJs then you may use an editor command to show a screen shot of the last test that was executed by Wallaby, the setting should be set as |
'files' |
the mandatory configuration property | ['string'|'object'] |
The files array property specifies an array of source files or file name patterns. Make sure that all files used by your tests are listed in the config'files' list.Exceptions:
Please check about an object additional properties details here. |
'tests' |
the mandatory configuration property | ['string'| 'object'] |
To specify an array of test files or test file name patterns, use the tests array property. IMPORTANT:only actual test files should be specified in the tests list, i.e. the files with specs/tests (for example withdescribe/it for mocha/jasmine).
Please check about an object additional properties details here. |
'env' |
'PhantomJs' |
['boolean' | 'string' | 'object'] |
The env property to specify a different test runner or change the runner settings. Please see runner settings. |
'compilers' |
'TypeScript' & 'CoffeeScript' |
An object with file patterns as keys and compiler functions as values. |
To allow for compilation from anything to JavaScript (ES6 or earlier), wallaby.js supports compilers that run before instrumentation and preprocessors. |
'middleware' |
Wallaby.js copies all files specified in the 'files' and 'tests' lists to its own cache. |
'object' |
Function middleware to just specify some file(s) or a folder that wallaby.js will serve ‘as is,’ without copying it to its local cache, or instrumenting or processing it. |
'workers' |
It’s recommended to skip setting the property. | 'object' |
The workers property specifies the degree of parallelism used to run your tests and controls the way wallaby.js re-uses workers. |
Files and tests: an object additional properties
| Option | Default | Type | Description |
|---|---|---|---|
'pattern' |
The rule applies to all file configuration properties, except the 'ignore' property - if a file pattern is marked as ignored, it will be ignored regardless of its position in the files/tests list. |
'string' |
Use the property Pattern to represent the file name or pattern. Each file is checked against patterns from the top of the list to the bottom. |
'ignore' |
'false' |
'boolean' |
Use the property Ignore to completely exclude the file from being processed by wallaby.js. |
'instrument' |
'true' |
'boolean' |
Setting the property Instrument to |
'load' |
'true' |
'boolean' |
Setting the property Load to NOTE: if your browser tests or code load some files dynamically and you don’t want them to be loaded into your sandbox immediately via |
'binary' |
'false' |
'boolean' |
The property Binary tells wallaby whether the file is binary (this affects how the file gets copied to wallaby cache). |
Runner (environment)
| Option | Default | Type | Description |
|---|---|---|---|
'env.type' |
'browser' |
'browser'|'node' |
To use |
'env.kind' |
'chrome' |
'chrome'|'electron'|'phantomjs' |
To set a test runner |
'env.options' |
'Default' |
'object' |
The setting env.options is to pass an object of Electron BrowserWindow options. |
'env.runner' |
'Default' |
'string' |
The env.runner property should be set to your local |
'env.params.runner' |
'Default' |
'object' |
The env.params.runner property to set space-separated spawned runner process flags. |
'env.params.env' |
'Default' |
'object' |
The env.params.env property to set semicolon-separated spawned runner process environment variables. |
'env.viewportSize' |
{width: 800, height: 600} |
'object' |
The env.viewportSize property to set PhantomJs/Electron page viewport size. |
'env.report404AsError' |
'false' |
'boolean' |
The env.report404AsError property allows you to report any 404 server hits as errors to Wallaby Console. |
Preprocessors
NOTE: you don’t need a preprocessor to use Babel or Webpack/Browserify with wallaby.js.
| Option | Default | Type | Description |
|---|---|---|---|
'file.content' |
Default | 'string' | 'object' | 'error object' |
The current content of the file. |
'file.path' |
Default | 'string' | 'object' | 'error object' |
The current path to the file. |
'file.rename(newPath)' |
Default | 'string' | 'object' | 'error object' |
Allows you to rename/move the file. |
'file.changeExt(newExt)' |
Default | 'string' | 'object' | 'error object' |
Allow you to change the file extension. |
Please note that if the transformation produces a JavaScript file that you are interested to see the coverage for, then returning the source map is essential. Otherwise, the reported coverage and error stacks may not be correct.
Postprocessors
| Option | Default | Type | Description |
|---|---|---|---|
'logger' |
'false' |
'boolean' |
|
'anyFilesAdded' | 'anyFilesDeleted' |
'false' |
'boolean' |
Return whether or not any files have been added or deleted for the current batch of changes. |
'nodeModulesDir' |
'false' |
'boolean' |
Returns the local project node modules folder. |
'baseDir' |
'false' |
'boolean' |
Returns wallaby cache project folder. |
The file objects inside 'allFiles', 'affectedFiles' and 'affectedTestFiles' have the following structure:
|
|||
'path' |
Default | 'string' |
The relative path of the file (relative to 'baseDir'). |
'fullPath' |
Default | 'string' |
The full path of the file in 'baseDir'). |
'binary' |
Default | 'boolean' |
Returns 'true' if the file is a binary file (file content in this case is a base64 encoded string). |
'ts' |
Default | 'number' |
Contains the file change timestamp. |
'id' |
Default | Type | Contains the file integer identifier in wallaby.js. |
'type' |
Default | 'string' |
Contains the file type, like ‘js’ or ‘html’. |
'load' |
Default | 'boolean' |
Allows to determine whether the file is loaded via a script tag into the generated sandbox. |
'instrument' |
Default | 'boolean' |
Ahe same as in the configuration 'files' object. |
'test' |
Default | 'boolean' |
Allow to determine whether the file is a test file. |
'getContent' |
Default | Type | The 'getContent' function returns a promise; when resolved it returns the file string content. |
File objects passed to the 'createFile' function as an argument should have the following structure:
|
|||
'path' |
Default | 'string' |
The relative path of the file (relative to 'baseDir'). |
'load' |
Default | 'boolean' |
Allows to determine whether the file is loaded via a script tag into the generated sandbox. |
'order' |
Default | 'number' |
Allows to control the file order in the list of all files included into the sandbox. |
'ts' |
the current time | 'number' |
Contains the file change timestamp. |
'content' |
Default | 'string' |
Content of the file. |
'sourceMap' |
Default | 'string' |
Allow to pass the source map in case the created file is a transformed version of some other file. The property should be used in conjunction with the 'original' file property. |
'original' |
Default | 'string' |
Allow to pass another file object. |
Setup
| Option | Default | Type | Description |
|---|---|---|---|
'tests' |
Default | Type | Contain the list of all test files that wallaby.js knows about. |
'testFramework' |
Default | Type | Contains a reference to the test framework object. |
| The following additional properties are available in node.js environments: | |||
'localProjectDir' |
Default | 'string' |
Return the project local folder. |
'projectCacheDir' |
Default | 'string' |
Returns the project cache folder. Note: wallaby.js uses files from this folder to run tests. It copies the files specified in files and tests lists from 'localProjectDir' to 'projectCacheDir'. |
'workerId' |
The number is always between 0 and MAX(worker.initial, workers.regular) - 1. |
'number' |
Return the id of a worker that runs tests. |
'sessionId' |
Default | 'number' |
A unique identifier of a test run. |
'teardown' |
Default | 'object' |
To clean up after your tests or to set up in the setup function and not in your testing frameworks before/after hooks. |
Important: The setup function is executed in the context of the test runner, not in the context of the configuration file.
Workers
| Option | Default | Type | Description |
|---|---|---|---|
'initial' |
It’s recommended to skip setting the property. | 'number' |
Use the |
'regular' |
It’s recommended to skip setting the property. | 'number' |
Use the |
'restart' |
It’s recommended to skip setting the property. | 'boolean' |
The 'restart' property determines whether wallaby.js should restart workers.
|
Coverage settings
| Option | Default | Type | Description |
|---|---|---|---|
'filesWithNoCoverageCalculated' |
Default | 'string' |
To exclude a file from code coverage calculation reported in the Wallaby App use the |
'ignoreCoverageForFile' |
'/ignore file coverage/' |
'string' |
Use the |
'ignoreCoverage' |
'/ignore coverage|istanbul ignore/' |
'string' |
Use the 'ignoreCoverage' setting to ignore code for coverage purposes by using comment hints. |