https://github.com/weisjohn/best
https://github.com/weisjohn/best
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/weisjohn/best
- Owner: weisjohn
- Created: 2019-10-16T02:46:12.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2016-02-10T03:07:36.000Z (over 10 years ago)
- Last Synced: 2025-10-29T11:43:05.872Z (9 months ago)
- Size: 47.9 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# best
run arbitrarily defined best practice tests
### quick start
1. Clone the repo: `git clone https://github.com/clevertech/Best.git`
2. Install dependencies `npm install`
3. Create a global binary for the cli `npm link`
### usage
```javascript
var config = { 'url': 'http://example.net/' };
best(config, function(err, rules) {
console.log('failing rules', rules.fail);
console.log('passing rules', rules.pass);
});
```
### cli
First, define a [`.bestrc`](./.bestrc) file in the directory you wish to use, then run `$ best`. If any rules fail, `best` returns a non-zero exit code. This is helpful if you wish to include it as part of a build process.
Alternatively, specify config via command-line parameters: `$ best --url http://example.net`
`best` also has a simple JSON reporter, if you wish to capture the output: `$ best -o`
### configuration
`best` ships with [predefined rules](./rules/README.md), which you may ignore by adding to your config a `rules` object, with the name of the rule marked as ignore, similar to `.eslintrc` configuration:
```javascript
{
"url": "http://example.net/",
"rules": {
"cache": [0]
}
}
```
You can additionally specify [your own rules](./rules/README.md) by attaching them to the "rules" object.
### debug
`best` uses [`debug`](https://www.npmjs.com/package/debug) heavily to show what's going on under the hood: `$ DEBUG="best:*" best`