api-tuner 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,13 +27,14 @@
27
27
  Usage: api-tuner [options] <path>...
28
28
 
29
29
  Options:
30
- --lib <path> Specify rules to include in all tests
30
+ --lib <path> Specify rules to include in all tests. Can be used multiple times. Make sure to surround globs in quotes to prevent expansion.
31
31
  --silent Less output
32
32
  --debug Enable debug output
33
33
  --raw Output raw results from eye
34
34
  --base-iri <iri> Specify the base IRI for parsing the test case files
35
35
  --version Show version information
36
36
  --help Show this help message
37
+
37
38
  ```
38
39
 
39
40
  ## Example
package/bin/tuner.sh CHANGED
@@ -15,7 +15,7 @@ function version() {
15
15
  echo "Usage: api-tuner [options] <path>..."
16
16
  echo ""
17
17
  echo "Options:"
18
- echo " --lib <path> Specify rules to include in all tests"
18
+ echo " --lib <path> Specify rules to include in all tests. Can be used multiple times. Make sure to surround globs in quotes to prevent expansion."
19
19
  echo " --silent Less output"
20
20
  echo " --debug Enable debug output"
21
21
  echo " --raw Output raw results from eye"
@@ -24,6 +24,7 @@ function version() {
24
24
  echo " --help Show this help message"
25
25
  }
26
26
 
27
+ PARALLEL=true
27
28
  SILENT=false
28
29
  BASE_IRI=""
29
30
  DEBUG=false
@@ -50,6 +51,10 @@ while [ $# -gt 0 ]; do
50
51
  shift
51
52
  shift
52
53
  ;;
54
+ --no-parallel)
55
+ PARALLEL=false
56
+ shift
57
+ ;;
53
58
  --version)
54
59
  version
55
60
  exit 0
@@ -87,9 +92,30 @@ if [ "$SILENT" != true ]; then
87
92
  fi
88
93
 
89
94
  set -o pipefail
90
- for path in "${PATHS[@]}"; do
91
- (
92
- node "${SCRIPT_PATH}/../lib/parse-test-case.js" --base-iri "$BASE_IRI" -- "${path}" \
93
- | $eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 ${LIBS[@]:+"${LIBS[*]}"} -
94
- ) ;
95
- done | $SUMMARY
95
+ process_path() {
96
+ local path="$1"
97
+ if [ "$SILENT" != true ] & [ $PARALLEL == false ]; then
98
+ echo "" >&2
99
+ echo "⚡️ RUNNING <file://$(realpath "$path")>" >&2
100
+ fi
101
+ node "${SCRIPT_PATH}/../lib/parse-test-case.js" --base-iri "$BASE_IRI" -- "${path}" \
102
+ | $eye $ARGS "${SCRIPT_PATH}"/../rules/*.n3 ${LIBS[@]:+${LIBS[*]}} - \
103
+ 2> >(while read -r line; do
104
+ echo "$line" | sed -E 's/^"INFO" TRACE "(.*)"/ℹ️ \1/; s/^"DEBUG" TRACE "(.*)"/🐞 \1/' >&2
105
+ done)
106
+ }
107
+
108
+
109
+ # if parallel
110
+ if [ "$PARALLEL" = true ]; then
111
+ # run in parallel
112
+ for path in "${PATHS[@]}"; do
113
+ process_path "$path" &
114
+ done
115
+ wait
116
+ else
117
+ # run sequentially
118
+ for path in "${PATHS[@]}"; do
119
+ process_path "$path"
120
+ done
121
+ fi | $SUMMARY
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "api-tuner",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "license": "MIT",