diff --git a/package.json b/package.json index 095d183..b4a6190 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "lint": "node_modules/.bin/gulp lint", "dev": "node_modules/.bin/gulp", "serve": "NODE_ENV=production node src/index", - "test": "node_modules/.bin/gulp lint" + "test": "node_modules/.bin/gulp lint && node_modules/.bin/mocha", + "coverage": "node_modules/.bin/nyc node_modules/.bin/mocha" }, "dependencies": { "@base-cms/object-path": "^0.6.0", @@ -20,11 +21,29 @@ "express": "^4.16.4" }, "devDependencies": { + "chai": "^4.2.0", + "chai-as-promised": "^7.1.1", "eslint": "^5.16.0", "eslint-config-airbnb-base": "^13.1.0", "eslint-plugin-import": "^2.16.0", "gulp": "^4.0.0", "gulp-cached": "^1.1.1", - "gulp-eslint": "^5.0.0" + "gulp-eslint": "^5.0.0", + "mocha": "^6.1.2", + "nyc": "^13.3.0", + "sinon": "^7.3.1", + "supertest": "^4.0.2" + }, + "nyc": { + "check-coverage": false, + "per-file": true, + "reporter": [ + "text" + ], + "all": true, + "cache": false, + "include": [ + "src/**/*.js" + ] } } diff --git a/scripts/coverage.sh b/scripts/coverage.sh new file mode 100755 index 0000000..d96da3f --- /dev/null +++ b/scripts/coverage.sh @@ -0,0 +1,5 @@ +#!/bin/bash +docker-compose run \ + --rm \ + yarn \ + run coverage $@ diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 0000000..dc7f784 --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +docker-compose run \ + --rm \ + yarn \ + run test $@ diff --git a/src/rules/pennwell/README.md b/src/rules/pennwell/README.md index 4246ca0..d2668b2 100644 --- a/src/rules/pennwell/README.md +++ b/src/rules/pennwell/README.md @@ -6,6 +6,9 @@ To access, send a `POST` request to `/pennwell/default`. This rule set performs - Extracts the `deck` text from elements classed with `.paraStyle_headline_deck` and removes the element from the cleaned HTML. - Extracts an `author` object from elements classed with `.paraStyle_byline` or `.paraStyle_body_bio` and removes the elements from the cleaned HTML. - If an `