UNPKG

1.74 kBMarkdownView Raw
1[![Build Status](https://travis-ci.org/gextech/nwrun.svg?branch=master)](https://travis-ci.org/gextech/nwrun)
2
3Look ma', without `.json` files:
4
5```javascript
6var argv = require('minimist')(process.argv.slice(2)),
7 nwrun = require('nwrun');
8
9nwrun({
10 argv: argv,
11 force: argv.force,
12 target: argv.target,
13 standalone: argv.standalone,
14 src_folders: process.cwd() + '/tests',
15 output_folder: process.cwd() + '/reports'
16}, function(success) {
17 if (!success) {
18 process.exit(1);
19 }
20});
21```
22
23## Why?
24
25This is just a dirty-hack based on `nightwatch.initGrunt()` method due compatibility issues with `grunt-nightwatch` itself.
26
27Unlike other solutions we are not spawning the nightwatch process, instead, we fake its settings in runtime.
28
29Another interesting feature is the downloading of the `selenium-server-standalone*.jar` file.
30
31Is like running nightwatch but programmatically.
32
33## API
34
35`nwrun(options, callback)`
36
37**Options**
38
39- `argv` — main argvs for the nightwatch instance
40- `force` — always force the download of the selenium jar
41- `target` — shortcut for specifying environments ( `--env a,b`)
42- `standalone` — if true will start selenium (will be downloaded if missing)
43- `jar_url` — custom endpoint for the downloading the selenium jar
44- `jar_path` — custom directory for saving the selenium jar locally
45- `jar_version` — custom version for the given `jar_url`, e.g. `2.45.0`
46- `config_path` — custom path for JSON settings and options, it can be overriden per target
47
48When done `callback(success)` will get executed.
49
50If `success` is false means something failed.
51
52Otherwise you're done.
53
54> All other options are passed directly to the `nightwatch.runner()` method.