auditing
v0.0.7
Published
Set the audits once and just run the tests
Downloads
10
Readme
Auditing
Set the audits once and just run the tests. The runner is based on mocha.
Installation
- Install node
cd <project_folder>
npm init # If you don't have a package.json already
npm install --save-dev auditing
Usage
Core usage
I still have to document how you can require
and use the core
directly but just so that you know, you can do it and the results are based on promises
.
CLI
Set a .audit.json
and run all the tasks you want when you pass it to auditing
.
Note: Any kind of path should be absolute or relative to the place the script is called.
node <mocha_path> <auditing> --mocha=true --config=<config_src>
Notes:
<mocha_path>
: Pass the path to mocha. For examplenode_modules/mocha/bin/mocha
. You could simply usemocha
instead if you have it globally or if you're usingnpm scripts
. It is required<auditing>
: Set the path for the auditing main index.js file. It is required<config_json_src>
: Path to the config json for crawling. It is required
Example
node ./node_modules/mocha/bin/mocha ./node_modules/auditing/dist/index.js --mocha=true --config=".audit.json"
Configuration
{
"projectId": "<project_id>",
"projectName": "<project_name>",
"data": [{
"src": ["<url_path>", "<content|markup>", "<file>"],
"type": "url|content|file",
"type": {
"of": "url",
"base": "<optional_url_base_path>",
"baseEnv": "<optional_env_var_to_set_base_upon>"
},
"enableJs": false,
"waitFor" : "<html_selector>",
"audits": ["<path_to_custom>", {
"src": "<path_to_custom>",
"ignore": ["<pattern_to_ignore>"]
}]
}]
}
Notes:
type
: It can be anobject
or astring
enableJs
: Javascript isn't enable by default for security reasons. Use this if you really need itwaitFor
: Usually used withenableJs
. If the sources uses javascript to render, you maywaitFor
the selector to be present. It will only wait20
secondsbase
: Option only available for type url. Optional keybaseEnv
: Option only available for type url. Optional keyignore
: Ignore rules and nested messages with ignore
Examples
Go under the src/_test/data folder and check the *.json
.