From 8de2ac08a4901df47d440a2024bd7a740dc1e50f Mon Sep 17 00:00:00 2001 From: David Chambers Date: Sun, 7 Jan 2024 12:39:26 +0100 Subject: [PATCH] sanctuary-scripts@7.0.x --- .config | 1 + .eslintrc.json | 17 ++++++++--------- package.json | 4 +--- scripts/test | 27 ++++++++++++++++++--------- 4 files changed, 28 insertions(+), 21 deletions(-) diff --git a/.config b/.config index 7970d79..b6ef54f 100644 --- a/.config +++ b/.config @@ -3,4 +3,5 @@ repo-name = doctest author-name = David Chambers source-files = bin/doctest lib/**/*.js readme-source-files = +test-files = test/index.js version-tag-prefix = diff --git a/.eslintrc.json b/.eslintrc.json index 6983191..b2aea12 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,14 +7,6 @@ "comma-dangle": ["error", {"arrays": "always-multiline", "objects": "always-multiline", "imports": "always-multiline", "exports": "always-multiline", "functions": "never"}] }, "overrides": [ - { - "files": ["README.md"], - "globals": {"doctest": "readonly"}, - "rules": { - "no-extra-semi": ["off"], - "no-unused-vars": ["error", {"varsIgnorePattern": "^(toFahrenheit)$"}] - } - }, { "files": ["bin/doctest"], "parserOptions": {"sourceType": "script"} @@ -26,9 +18,16 @@ "spaced-comment": ["error", "always", {"markers": ["/"]}] } }, + { + "files": ["test/**/*.js"], + "rules": { + "max-len": ["off"] + } + }, { "files": ["test/commonjs/**/index.js"], - "parserOptions": {"sourceType": "script"} + "parserOptions": {"sourceType": "script"}, + "globals": {"__doctest": "readonly"} } ] } diff --git a/package.json b/package.json index 896f2c0..1d36b18 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,7 @@ "sanctuary-type-classes": "13.0.x" }, "devDependencies": { - "c8": "8.0.x", - "oletus": "4.0.x", - "sanctuary-scripts": "6.0.x" + "sanctuary-scripts": "7.0.x" }, "scripts": { "doctest": "sanctuary-doctest", diff --git a/scripts/test b/scripts/test index 3e4b79c..ee368f7 100755 --- a/scripts/test +++ b/scripts/test @@ -1,16 +1,25 @@ #!/usr/bin/env bash set -euf -o pipefail -source "${BASH_SOURCE%/*}/../node_modules/sanctuary-scripts/functions" +source "$(dirname "$(dirname "$(realpath "${BASH_SOURCE[0]}")")")/node_modules/sanctuary-scripts/functions" + +branches="$(get min-branch-coverage)" set +f ; shopt -s globstar nullglob -files=($(get source-files)) +# shellcheck disable=SC2207 +source_files=($(get source-files)) +# shellcheck disable=SC2207 +test_files=($(get test-files)) set -f ; shopt -u globstar nullglob -node_modules/.bin/c8 \ - --check-coverage \ - --100 \ - --reporter text \ - --reporter html \ - $(printf ' --include %s' "${files[@]}") \ - node --experimental-vm-modules -- node_modules/.bin/oletus -- test/index.js +args=( + --check-coverage + --branches "$branches" + --functions 0 + --lines 0 + --statements 0 +) +for name in "${source_files[@]}" ; do + args+=(--include "$name") +done +node_modules/.bin/c8 "${args[@]}" -- node --experimental-vm-modules -- node_modules/.bin/oletus -- "${test_files[@]}"