-
Notifications
You must be signed in to change notification settings - Fork 23
Getting started
- Install nemo
npm install --save-dev nemo
- Use the scaffold feature to add a basic nemo test suite
$ ./node_modules/.bin/nemo -X test
DONE!
Next steps:
1. Add a script to package.json. E.g. "nemo": "nemo -B test"
2. Make sure you have latest chrome/chromedriver installed (https://sites.google.com/a/chromium.org/chromedriver/getting-started)
- The binary should be in your PATH
3. Run nemo! "npm run nemo"
4. Explore the files under test/functional
5. Learn more: http://nemo.js.org
- Get the chromedriver if necessary, then run nemo!
$ ./bin/nemo -B test
@firstTest@
✓ should load a website (1926ms)
1 passing (3s)
┌────────────────────────────────────────────────────────────────┬──────┬──────┬───────┐
│ tags │ pass │ fail │ total │
├────────────────────────────────────────────────────────────────┼──────┼──────┼───────┤
│ profile: base │ 1 │ 0 │ 1 │
│ reportFile: /07-14-2018/11-11-34/profile!base/nemo-report.html │ │ │ │
│ │ │ │ │
├────────────────────────────────────────────────────────────────┼──────┼──────┼───────┤
│ TOTALS │ 1 │ 0 │ 1 │
└────────────────────────────────────────────────────────────────┴──────┴──────┴───────┘
To view all CLI arguments, use nemo --help
$ ./bin/nemo --help
Usage: _nemo [options]
Options:
-V, --version output the version number
-B, --base-directory <path> parent directory for config/ and spec/ (or other test file) directories. relative to cwd
-P, --profile [profile] which profile(s) to run, out of the configuration
-G, --grep <pattern> only run tests matching <pattern>
-F, --file run parallel by file
-D, --data run parallel by data
-S, --server run the nemo web server
-L, --logging info level logging (errors log by default)
-X, --scaffold <path> inject an example nemo suite under <path>
-U, --allow-unknown-args allow command line arguments not specified by Nemo
--debug-brk enable node's debugger breaking on the first line
--inspect activate devtools in chrome
--no-timeouts remove timeouts in debug/inspect use case
-h, --help output usage information
Nemo's configuration is read by confit. Confit allows you to add comments to your JSON files. It uses shortstop, which allows you to configure special processing within your JSON.
Simple example:
{
"plugins": {
"view": {
"module": "nemo-view"
}
},
"output": {
// using "path" shortstop handler
// resolves to nemo base directory
"reports": "path:report"
},
"profiles": {
"base": {
"data": {
"baseUrl": "https://www.google.com"
},
"tests": "path:./tests/*",
"mocha": {
"timeout": 180000,
"reporter": "mochawesome",
"reporterOptions": {
"quiet": true
}
}
},
"firefox": {
"driver": {
"browser": "firefox"
}
}
}
}
A "profile" configuration has all information necessary to run nemo
for a particular environment or scenario.
profiles.base
in config.json
is required, and is the default and parent configuration. All other profiles will inherit from and merge with the base profile.
For example, with the profiles
configuration from above:
"profiles": {
"base": {
"data": {
"baseUrl": "https://www.google.com"
},
"tests": "path:./tests/*",
"mocha": {
"timeout": 180000,
"reporter": "mochawesome",
"reporterOptions": {
"quiet": true
}
}
},
"firefox": {
"driver": {
"browser": "firefox"
}
}
}
Running the firefox profile will merge the base
profile object with firefox
profile object. In this case the only difference is using "firefox" instead of "chrome" as the browser. But you could likewise override any other base profile setting with the firefox
profile object.
You would run with the base
profile this way:
$ nemo -B test
And with the firefox
profile this way:
$ nemo -B test -P firefox
You can also choose to run the two in parallel this way:
$ nemo -B test -P base,firefox
Here are all the available profile configuration attributes
Name | Type | Default | Description |
---|---|---|---|
output | |||
output.reports | |||
output.listeners | |||
output.storage | |||
base | |||
base.driver | |||
base.tests | |||
base.mocha | |||
base.parallel | |||
base.driverPerTest | |||
base.data | |||
base.env | |||
base.maxConcurrent |