@calmo/task-runner 1.1.0 → 1.1.1
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/.github/workflows/ci.yml +7 -0
- package/CHANGELOG.md +32 -0
- package/GEMINI.md +5 -1
- package/README.md +20 -0
- package/coverage/TaskRunner.ts.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/lcov-report/TaskRunner.ts.html +685 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +108 -0
- package/package.json +1 -1
- package/sonar-project.properties +22 -0
- package/test-report.xml +59 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
var addSorting = (function() {
|
|
3
|
+
'use strict';
|
|
4
|
+
var cols,
|
|
5
|
+
currentSort = {
|
|
6
|
+
index: 0,
|
|
7
|
+
desc: false
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
// returns the summary table element
|
|
11
|
+
function getTable() {
|
|
12
|
+
return document.querySelector('.coverage-summary');
|
|
13
|
+
}
|
|
14
|
+
// returns the thead element of the summary table
|
|
15
|
+
function getTableHeader() {
|
|
16
|
+
return getTable().querySelector('thead tr');
|
|
17
|
+
}
|
|
18
|
+
// returns the tbody element of the summary table
|
|
19
|
+
function getTableBody() {
|
|
20
|
+
return getTable().querySelector('tbody');
|
|
21
|
+
}
|
|
22
|
+
// returns the th element for nth column
|
|
23
|
+
function getNthColumn(n) {
|
|
24
|
+
return getTableHeader().querySelectorAll('th')[n];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function onFilterInput() {
|
|
28
|
+
const searchValue = document.getElementById('fileSearch').value;
|
|
29
|
+
const rows = document.getElementsByTagName('tbody')[0].children;
|
|
30
|
+
|
|
31
|
+
// Try to create a RegExp from the searchValue. If it fails (invalid regex),
|
|
32
|
+
// it will be treated as a plain text search
|
|
33
|
+
let searchRegex;
|
|
34
|
+
try {
|
|
35
|
+
searchRegex = new RegExp(searchValue, 'i'); // 'i' for case-insensitive
|
|
36
|
+
} catch (error) {
|
|
37
|
+
searchRegex = null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
for (let i = 0; i < rows.length; i++) {
|
|
41
|
+
const row = rows[i];
|
|
42
|
+
let isMatch = false;
|
|
43
|
+
|
|
44
|
+
if (searchRegex) {
|
|
45
|
+
// If a valid regex was created, use it for matching
|
|
46
|
+
isMatch = searchRegex.test(row.textContent);
|
|
47
|
+
} else {
|
|
48
|
+
// Otherwise, fall back to the original plain text search
|
|
49
|
+
isMatch = row.textContent
|
|
50
|
+
.toLowerCase()
|
|
51
|
+
.includes(searchValue.toLowerCase());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
row.style.display = isMatch ? '' : 'none';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// loads the search box
|
|
59
|
+
function addSearchBox() {
|
|
60
|
+
var template = document.getElementById('filterTemplate');
|
|
61
|
+
var templateClone = template.content.cloneNode(true);
|
|
62
|
+
templateClone.getElementById('fileSearch').oninput = onFilterInput;
|
|
63
|
+
template.parentElement.appendChild(templateClone);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// loads all columns
|
|
67
|
+
function loadColumns() {
|
|
68
|
+
var colNodes = getTableHeader().querySelectorAll('th'),
|
|
69
|
+
colNode,
|
|
70
|
+
cols = [],
|
|
71
|
+
col,
|
|
72
|
+
i;
|
|
73
|
+
|
|
74
|
+
for (i = 0; i < colNodes.length; i += 1) {
|
|
75
|
+
colNode = colNodes[i];
|
|
76
|
+
col = {
|
|
77
|
+
key: colNode.getAttribute('data-col'),
|
|
78
|
+
sortable: !colNode.getAttribute('data-nosort'),
|
|
79
|
+
type: colNode.getAttribute('data-type') || 'string'
|
|
80
|
+
};
|
|
81
|
+
cols.push(col);
|
|
82
|
+
if (col.sortable) {
|
|
83
|
+
col.defaultDescSort = col.type === 'number';
|
|
84
|
+
colNode.innerHTML =
|
|
85
|
+
colNode.innerHTML + '<span class="sorter"></span>';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return cols;
|
|
89
|
+
}
|
|
90
|
+
// attaches a data attribute to every tr element with an object
|
|
91
|
+
// of data values keyed by column name
|
|
92
|
+
function loadRowData(tableRow) {
|
|
93
|
+
var tableCols = tableRow.querySelectorAll('td'),
|
|
94
|
+
colNode,
|
|
95
|
+
col,
|
|
96
|
+
data = {},
|
|
97
|
+
i,
|
|
98
|
+
val;
|
|
99
|
+
for (i = 0; i < tableCols.length; i += 1) {
|
|
100
|
+
colNode = tableCols[i];
|
|
101
|
+
col = cols[i];
|
|
102
|
+
val = colNode.getAttribute('data-value');
|
|
103
|
+
if (col.type === 'number') {
|
|
104
|
+
val = Number(val);
|
|
105
|
+
}
|
|
106
|
+
data[col.key] = val;
|
|
107
|
+
}
|
|
108
|
+
return data;
|
|
109
|
+
}
|
|
110
|
+
// loads all row data
|
|
111
|
+
function loadData() {
|
|
112
|
+
var rows = getTableBody().querySelectorAll('tr'),
|
|
113
|
+
i;
|
|
114
|
+
|
|
115
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
116
|
+
rows[i].data = loadRowData(rows[i]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// sorts the table using the data for the ith column
|
|
120
|
+
function sortByIndex(index, desc) {
|
|
121
|
+
var key = cols[index].key,
|
|
122
|
+
sorter = function(a, b) {
|
|
123
|
+
a = a.data[key];
|
|
124
|
+
b = b.data[key];
|
|
125
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
126
|
+
},
|
|
127
|
+
finalSorter = sorter,
|
|
128
|
+
tableBody = document.querySelector('.coverage-summary tbody'),
|
|
129
|
+
rowNodes = tableBody.querySelectorAll('tr'),
|
|
130
|
+
rows = [],
|
|
131
|
+
i;
|
|
132
|
+
|
|
133
|
+
if (desc) {
|
|
134
|
+
finalSorter = function(a, b) {
|
|
135
|
+
return -1 * sorter(a, b);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
for (i = 0; i < rowNodes.length; i += 1) {
|
|
140
|
+
rows.push(rowNodes[i]);
|
|
141
|
+
tableBody.removeChild(rowNodes[i]);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
rows.sort(finalSorter);
|
|
145
|
+
|
|
146
|
+
for (i = 0; i < rows.length; i += 1) {
|
|
147
|
+
tableBody.appendChild(rows[i]);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// removes sort indicators for current column being sorted
|
|
151
|
+
function removeSortIndicators() {
|
|
152
|
+
var col = getNthColumn(currentSort.index),
|
|
153
|
+
cls = col.className;
|
|
154
|
+
|
|
155
|
+
cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, '');
|
|
156
|
+
col.className = cls;
|
|
157
|
+
}
|
|
158
|
+
// adds sort indicators for current column being sorted
|
|
159
|
+
function addSortIndicators() {
|
|
160
|
+
getNthColumn(currentSort.index).className += currentSort.desc
|
|
161
|
+
? ' sorted-desc'
|
|
162
|
+
: ' sorted';
|
|
163
|
+
}
|
|
164
|
+
// adds event listeners for all sorter widgets
|
|
165
|
+
function enableUI() {
|
|
166
|
+
var i,
|
|
167
|
+
el,
|
|
168
|
+
ithSorter = function ithSorter(i) {
|
|
169
|
+
var col = cols[i];
|
|
170
|
+
|
|
171
|
+
return function() {
|
|
172
|
+
var desc = col.defaultDescSort;
|
|
173
|
+
|
|
174
|
+
if (currentSort.index === i) {
|
|
175
|
+
desc = !currentSort.desc;
|
|
176
|
+
}
|
|
177
|
+
sortByIndex(i, desc);
|
|
178
|
+
removeSortIndicators();
|
|
179
|
+
currentSort.index = i;
|
|
180
|
+
currentSort.desc = desc;
|
|
181
|
+
addSortIndicators();
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
for (i = 0; i < cols.length; i += 1) {
|
|
185
|
+
if (cols[i].sortable) {
|
|
186
|
+
// add the click event handler on the th so users
|
|
187
|
+
// dont have to click on those tiny arrows
|
|
188
|
+
el = getNthColumn(i).querySelector('.sorter').parentElement;
|
|
189
|
+
if (el.addEventListener) {
|
|
190
|
+
el.addEventListener('click', ithSorter(i));
|
|
191
|
+
} else {
|
|
192
|
+
el.attachEvent('onclick', ithSorter(i));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// adds sorting functionality to the UI
|
|
198
|
+
return function() {
|
|
199
|
+
if (!getTable()) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
cols = loadColumns();
|
|
203
|
+
loadData();
|
|
204
|
+
addSearchBox();
|
|
205
|
+
addSortIndicators();
|
|
206
|
+
enableUI();
|
|
207
|
+
};
|
|
208
|
+
})();
|
|
209
|
+
|
|
210
|
+
window.addEventListener('load', addSorting);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
TN:
|
|
2
|
+
SF:src/TaskRunner.ts
|
|
3
|
+
FN:58,(anonymous_0)
|
|
4
|
+
FN:65,(anonymous_1)
|
|
5
|
+
FN:85,(anonymous_2)
|
|
6
|
+
FN:101,(anonymous_3)
|
|
7
|
+
FN:130,(anonymous_4)
|
|
8
|
+
FN:137,(anonymous_5)
|
|
9
|
+
FN:140,(anonymous_6)
|
|
10
|
+
FN:143,(anonymous_7)
|
|
11
|
+
FN:152,(anonymous_8)
|
|
12
|
+
FN:169,(anonymous_9)
|
|
13
|
+
FN:170,(anonymous_10)
|
|
14
|
+
FN:177,(anonymous_11)
|
|
15
|
+
FNF:12
|
|
16
|
+
FNH:12
|
|
17
|
+
FNDA:19,(anonymous_0)
|
|
18
|
+
FNDA:12,(anonymous_1)
|
|
19
|
+
FNDA:2,(anonymous_2)
|
|
20
|
+
FNDA:94,(anonymous_3)
|
|
21
|
+
FNDA:18,(anonymous_4)
|
|
22
|
+
FNDA:80,(anonymous_5)
|
|
23
|
+
FNDA:57,(anonymous_6)
|
|
24
|
+
FNDA:42,(anonymous_7)
|
|
25
|
+
FNDA:45,(anonymous_8)
|
|
26
|
+
FNDA:6,(anonymous_9)
|
|
27
|
+
FNDA:3,(anonymous_10)
|
|
28
|
+
FNDA:27,(anonymous_11)
|
|
29
|
+
DA:52,19
|
|
30
|
+
DA:53,19
|
|
31
|
+
DA:58,19
|
|
32
|
+
DA:69,12
|
|
33
|
+
DA:72,11
|
|
34
|
+
DA:75,12
|
|
35
|
+
DA:89,2
|
|
36
|
+
DA:90,1
|
|
37
|
+
DA:105,94
|
|
38
|
+
DA:108,94
|
|
39
|
+
DA:109,13
|
|
40
|
+
DA:110,13
|
|
41
|
+
DA:111,13
|
|
42
|
+
DA:114,1
|
|
43
|
+
DA:131,18
|
|
44
|
+
DA:133,18
|
|
45
|
+
DA:135,18
|
|
46
|
+
DA:136,26
|
|
47
|
+
DA:137,80
|
|
48
|
+
DA:140,26
|
|
49
|
+
DA:141,57
|
|
50
|
+
DA:142,57
|
|
51
|
+
DA:143,42
|
|
52
|
+
DA:148,26
|
|
53
|
+
DA:149,57
|
|
54
|
+
DA:150,56
|
|
55
|
+
DA:151,57
|
|
56
|
+
DA:152,45
|
|
57
|
+
DA:154,57
|
|
58
|
+
DA:155,7
|
|
59
|
+
DA:159,7
|
|
60
|
+
DA:160,7
|
|
61
|
+
DA:164,26
|
|
62
|
+
DA:169,6
|
|
63
|
+
DA:170,3
|
|
64
|
+
DA:171,3
|
|
65
|
+
DA:176,23
|
|
66
|
+
DA:178,27
|
|
67
|
+
DA:179,27
|
|
68
|
+
DA:180,27
|
|
69
|
+
DA:181,27
|
|
70
|
+
DA:182,25
|
|
71
|
+
DA:184,2
|
|
72
|
+
DA:189,27
|
|
73
|
+
DA:190,27
|
|
74
|
+
DA:191,27
|
|
75
|
+
DA:197,15
|
|
76
|
+
DA:198,15
|
|
77
|
+
LF:48
|
|
78
|
+
LH:48
|
|
79
|
+
BRDA:69,0,0,11
|
|
80
|
+
BRDA:69,0,1,1
|
|
81
|
+
BRDA:89,1,0,1
|
|
82
|
+
BRDA:89,1,1,1
|
|
83
|
+
BRDA:108,2,0,13
|
|
84
|
+
BRDA:108,2,1,81
|
|
85
|
+
BRDA:137,3,0,80
|
|
86
|
+
BRDA:137,3,1,57
|
|
87
|
+
BRDA:141,4,0,57
|
|
88
|
+
BRDA:141,4,1,19
|
|
89
|
+
BRDA:143,5,0,42
|
|
90
|
+
BRDA:143,5,1,19
|
|
91
|
+
BRDA:149,6,0,1
|
|
92
|
+
BRDA:149,6,1,56
|
|
93
|
+
BRDA:150,7,0,56
|
|
94
|
+
BRDA:150,7,1,19
|
|
95
|
+
BRDA:152,8,0,45
|
|
96
|
+
BRDA:152,8,1,19
|
|
97
|
+
BRDA:154,9,0,7
|
|
98
|
+
BRDA:154,9,1,50
|
|
99
|
+
BRDA:164,10,0,3
|
|
100
|
+
BRDA:164,10,1,23
|
|
101
|
+
BRDA:165,11,0,26
|
|
102
|
+
BRDA:165,11,1,6
|
|
103
|
+
BRDA:165,11,2,6
|
|
104
|
+
BRDA:186,12,0,1
|
|
105
|
+
BRDA:186,12,1,1
|
|
106
|
+
BRF:27
|
|
107
|
+
BRH:27
|
|
108
|
+
end_of_record
|
package/package.json
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
sonar.projectKey=thalesraymond_task-runner
|
|
2
|
+
sonar.organization=thalesraymond
|
|
3
|
+
|
|
4
|
+
# Name and Version (Optional, usually picked up from scanner or omitted)
|
|
5
|
+
# sonar.projectName=task-runner
|
|
6
|
+
# sonar.projectVersion=1.0
|
|
7
|
+
|
|
8
|
+
# Paths
|
|
9
|
+
sonar.sources=src
|
|
10
|
+
sonar.tests=tests
|
|
11
|
+
|
|
12
|
+
# Exclusions
|
|
13
|
+
sonar.cpd.exclusions=tests/**/*
|
|
14
|
+
sonar.coverage.exclusions=tests/**/*
|
|
15
|
+
|
|
16
|
+
# Coverage and Reports
|
|
17
|
+
sonar.javascript.lcov.reportPaths=coverage/lcov.info
|
|
18
|
+
sonar.typescript.lcov.reportPaths=coverage/lcov.info
|
|
19
|
+
sonar.junit.reportPaths=test-report.xml
|
|
20
|
+
|
|
21
|
+
# Encoding
|
|
22
|
+
sonar.sourceEncoding=UTF-8
|
package/test-report.xml
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
+
<testsuites name="vitest tests" tests="19" failures="0" errors="0" time="0.135083259">
|
|
3
|
+
<testsuite name="tests/ComplexScenario.test.ts" timestamp="2026-01-18T03:50:46.197Z" hostname="runnervmmtnos" tests="2" failures="0" errors="0" skipped="0" time="0.009883356">
|
|
4
|
+
<testcase classname="tests/ComplexScenario.test.ts" name="Complex Scenario Integration Tests > 1. All steps execute when all succeed and context is hydrated" time="0.006132912">
|
|
5
|
+
<system-out>
|
|
6
|
+
Running StepA
|
|
7
|
+
Running StepB
|
|
8
|
+
Running StepC
|
|
9
|
+
|
|
10
|
+
Running StepD
|
|
11
|
+
Running StepF
|
|
12
|
+
|
|
13
|
+
Running StepE
|
|
14
|
+
Running StepG
|
|
15
|
+
|
|
16
|
+
</system-out>
|
|
17
|
+
</testcase>
|
|
18
|
+
<testcase classname="tests/ComplexScenario.test.ts" name="Complex Scenario Integration Tests > 2. The 'skip' propagation works as intended if something breaks up in the tree" time="0.00153012">
|
|
19
|
+
</testcase>
|
|
20
|
+
</testsuite>
|
|
21
|
+
<testsuite name="tests/TaskRunner.test.ts" timestamp="2026-01-18T03:50:46.199Z" hostname="runnervmmtnos" tests="10" failures="0" errors="0" skipped="0" time="0.109323687">
|
|
22
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should run tasks in the correct sequential order" time="0.002455516">
|
|
23
|
+
</testcase>
|
|
24
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should handle an empty list of tasks gracefully" time="0.000305152">
|
|
25
|
+
</testcase>
|
|
26
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should run independent tasks in parallel" time="0.100731975">
|
|
27
|
+
</testcase>
|
|
28
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should skip dependent tasks if a root task fails" time="0.00046882">
|
|
29
|
+
</testcase>
|
|
30
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should throw an error for 'circular dependency'" time="0.00185594">
|
|
31
|
+
</testcase>
|
|
32
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should throw an error for 'missing dependency'" time="0.000228108">
|
|
33
|
+
</testcase>
|
|
34
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should handle tasks that throw an error during execution" time="0.000243576">
|
|
35
|
+
</testcase>
|
|
36
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should skip tasks whose dependencies are skipped" time="0.000262202">
|
|
37
|
+
</testcase>
|
|
38
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should handle tasks that throw a non-Error object during execution" time="0.000268865">
|
|
39
|
+
</testcase>
|
|
40
|
+
<testcase classname="tests/TaskRunner.test.ts" name="TaskRunner > should handle duplicate steps where one gets skipped due to failed dependency" time="0.00040515">
|
|
41
|
+
</testcase>
|
|
42
|
+
</testsuite>
|
|
43
|
+
<testsuite name="tests/TaskRunnerEvents.test.ts" timestamp="2026-01-18T03:50:46.201Z" hostname="runnervmmtnos" tests="7" failures="0" errors="0" skipped="0" time="0.015876216">
|
|
44
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should fire all lifecycle events in a successful run" time="0.004415742">
|
|
45
|
+
</testcase>
|
|
46
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should fire taskSkipped event when dependency fails" time="0.005824924">
|
|
47
|
+
</testcase>
|
|
48
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should not crash if a listener throws an error" time="0.001840071">
|
|
49
|
+
</testcase>
|
|
50
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should fire workflow events even for empty step list" time="0.000423804">
|
|
51
|
+
</testcase>
|
|
52
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should handle unsubscribe correctly" time="0.000460765">
|
|
53
|
+
</testcase>
|
|
54
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should safely handle off() when no listeners exist" time="0.000210355">
|
|
55
|
+
</testcase>
|
|
56
|
+
<testcase classname="tests/TaskRunnerEvents.test.ts" name="TaskRunner Events > should support multiple listeners for the same event" time="0.000482585">
|
|
57
|
+
</testcase>
|
|
58
|
+
</testsuite>
|
|
59
|
+
</testsuites>
|