1
0
Fork 0

lint: better test targets, misc shell quotes

This commit is contained in:
ssube 2019-07-02 08:42:48 -05:00
parent 18751f8ec7
commit c879c784a7
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
3 changed files with 22 additions and 21 deletions

View File

@ -87,15 +87,28 @@ build-bundle: node_modules
build-image: build-bundle
docker build $(ROOT_PATH)
test: test-mocha test-examples
test-mocha: ## run small (unit) tests
test-mocha: build-bundle
$(NODE_BIN)/mocha $(TARGET_PATH)/test.js
test: test-bundle test-rules test-examples
test-examples: ## run medium (feature) tests
$(SCRIPT_PATH)/test-examples.sh
test-bundle: ## run small (unit) tests
test-bundle: build-bundle
$(NODE_BIN)/mocha $(TARGET_PATH)/test.js
test-rules: ## validate the rules directory
test-rules: build-bundle
find $(ROOT_PATH)/rules -maxdepth 1 -name '*.yml' | while read file; \
do \
echo "Validating $${file}..."; \
node out/index.js \
--config-path $(ROOT_PATH)/docs \
--config-name config-stderr.yml \
--rules $(ROOT_PATH)/rules/salty-dog.yml \
--source $${file} \
--tag salty-dog > /dev/null || exit 1; \
done
yarn-install: ## install dependencies from package and lock file
yarn
@ -137,18 +150,6 @@ upload-codecov:
run-help: ## print the help
@node out/index.js --help
run-rules: ## validate the rules directory
find $(ROOT_PATH)/rules -maxdepth 1 -name '*.yml' | while read file; \
do \
echo "Validating $${file}..."; \
node out/index.js \
--config-path $(ROOT_PATH)/docs \
--config-name config-stderr.yml \
--rules $(ROOT_PATH)/rules/salty-dog.yml \
--source $${file} \
--tag salty-dog > /dev/null || exit 1; \
done
run-stream: ## validate stdin and write it to stdout, errors to stderr
@node out/index.js \
--config-path $(ROOT_PATH)/docs \

View File

@ -252,7 +252,7 @@ To enable a group of rules by tag, `--include-tag foo`.
To validate the rules in the `rules/` directory using the meta-rules:
```shell
> make run-rules
> make test-rules
...
{"name":"salty-dog","hostname":"cerberus","pid":29403,"level":30,"msg":"all rules passed","time":"2019-06-16T00:56:55.132Z","v":0}

View File

@ -27,12 +27,12 @@ do
--config-path ./docs \
--config-name config-stderr.yml \
--rules "rules/${USE_RULES}.yml" \
--tag ${USE_TAGS} \
--source ${example}
--tag "${USE_TAGS}" \
--source "${example}"
ACTUAL_STATUS=$?
if [[ ${ACTUAL_STATUS} != ${EXPECTED_STATUS} ]];
if [[ "${ACTUAL_STATUS}" != "${EXPECTED_STATUS}" ]];
then
echo "Exit status does not match! (expected ${EXPECTED_STATUS}, got ${ACTUAL_STATUS})"
exit 1