a-pollo
Version:
The visual CSS style guide for teams
72 lines (47 loc) • 1.37 kB
Markdown
We are using tap as test suite
```
npm test
```
```
node test/tap/annotations.spec.js
```
```
npm test -- --cov
```
This will generate a full HTML report with every detail on coverage
```
npm test -- --cov --coverage-report=lcov
```
---
Save data with this helper, this will generate a `JSON` file with the data you pass as second parameter
```
const saveJson = require('save-json') // test/save-json.js
const exitWhenFinished = true
saveJson('path/to/file.json', {
title: 'Title of this JSON data'
}, exitWhenFinished)
```
Or simply
```
require('./test/save-json')('test/tap/data/decorate-colors.json', files, true)
```
#### Load JSON data in tests
In the tap tests, load json data with `fixtures` helper, data is expected to be located in `/test/tap/data` path the extension will be automatically added
```
const fixtures = require('../tap-helper').fixtures('json-file')
console.log(fixtures)
```
This will log JSON data as YAML in conosole with colored element names
```
const prettyjson = require('prettyjson')
const decoratedAnnotations = require('../tap-helper').fixtures('decorated-annotations')
console.log(prettyjson.render(decoratedAnnotations))
```