@curl-runner/cli 1.16.0 → 1.16.2

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.
Files changed (40) hide show
  1. package/package.json +2 -2
  2. package/src/ci-exit.test.ts +0 -216
  3. package/src/cli.ts +0 -1351
  4. package/src/commands/upgrade.ts +0 -262
  5. package/src/diff/baseline-manager.test.ts +0 -181
  6. package/src/diff/baseline-manager.ts +0 -266
  7. package/src/diff/diff-formatter.ts +0 -316
  8. package/src/diff/index.ts +0 -3
  9. package/src/diff/response-differ.test.ts +0 -330
  10. package/src/diff/response-differ.ts +0 -489
  11. package/src/executor/max-concurrency.test.ts +0 -139
  12. package/src/executor/profile-executor.test.ts +0 -132
  13. package/src/executor/profile-executor.ts +0 -167
  14. package/src/executor/request-executor.ts +0 -663
  15. package/src/parser/yaml.test.ts +0 -480
  16. package/src/parser/yaml.ts +0 -271
  17. package/src/snapshot/index.ts +0 -3
  18. package/src/snapshot/snapshot-differ.test.ts +0 -358
  19. package/src/snapshot/snapshot-differ.ts +0 -296
  20. package/src/snapshot/snapshot-formatter.ts +0 -170
  21. package/src/snapshot/snapshot-manager.test.ts +0 -204
  22. package/src/snapshot/snapshot-manager.ts +0 -342
  23. package/src/types/bun-yaml.d.ts +0 -11
  24. package/src/types/config.ts +0 -638
  25. package/src/utils/colors.ts +0 -30
  26. package/src/utils/condition-evaluator.test.ts +0 -415
  27. package/src/utils/condition-evaluator.ts +0 -327
  28. package/src/utils/curl-builder.test.ts +0 -165
  29. package/src/utils/curl-builder.ts +0 -209
  30. package/src/utils/installation-detector.test.ts +0 -52
  31. package/src/utils/installation-detector.ts +0 -123
  32. package/src/utils/logger.ts +0 -856
  33. package/src/utils/response-store.test.ts +0 -213
  34. package/src/utils/response-store.ts +0 -108
  35. package/src/utils/stats.test.ts +0 -161
  36. package/src/utils/stats.ts +0 -151
  37. package/src/utils/version-checker.ts +0 -158
  38. package/src/version.ts +0 -43
  39. package/src/watcher/file-watcher.test.ts +0 -186
  40. package/src/watcher/file-watcher.ts +0 -140
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curl-runner/cli",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
4
4
  "description": "A powerful CLI tool for HTTP request management using YAML configuration",
5
5
  "type": "module",
6
6
  "main": "./dist/cli.js",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "files": [
35
- "src",
35
+ "dist",
36
36
  "README.md"
37
37
  ],
38
38
  "devDependencies": {
@@ -1,216 +0,0 @@
1
- import { describe, expect, test } from 'bun:test';
2
- import type { ExecutionSummary, GlobalConfig } from './types/config';
3
-
4
- /**
5
- * Determines the appropriate exit code based on execution results and CI configuration.
6
- * This is a standalone function for testing purposes.
7
- */
8
- function determineExitCode(summary: ExecutionSummary, config: GlobalConfig): number {
9
- const { failed, total } = summary;
10
- const ci = config.ci;
11
-
12
- // If no failures, always exit with 0
13
- if (failed === 0) {
14
- return 0;
15
- }
16
-
17
- // Check CI exit code options
18
- if (ci) {
19
- // strictExit: exit 1 if ANY failures occur
20
- if (ci.strictExit) {
21
- return 1;
22
- }
23
-
24
- // failOn: exit 1 if failures exceed the threshold
25
- if (ci.failOn !== undefined && failed > ci.failOn) {
26
- return 1;
27
- }
28
-
29
- // failOnPercentage: exit 1 if failure percentage exceeds the threshold
30
- if (ci.failOnPercentage !== undefined && total > 0) {
31
- const failurePercentage = (failed / total) * 100;
32
- if (failurePercentage > ci.failOnPercentage) {
33
- return 1;
34
- }
35
- }
36
-
37
- // If any CI option is set but thresholds not exceeded, exit 0
38
- if (ci.failOn !== undefined || ci.failOnPercentage !== undefined) {
39
- return 0;
40
- }
41
- }
42
-
43
- // Default behavior: exit 1 if failures AND continueOnError is false
44
- return !config.continueOnError ? 1 : 0;
45
- }
46
-
47
- /**
48
- * Creates a mock execution summary for testing
49
- */
50
- function createSummary(total: number, failed: number): ExecutionSummary {
51
- return {
52
- total,
53
- successful: total - failed,
54
- failed,
55
- skipped: 0,
56
- duration: 1000,
57
- results: [],
58
- };
59
- }
60
-
61
- describe('CI Exit Code', () => {
62
- describe('default behavior (no CI options)', () => {
63
- test('should exit 0 when no failures', () => {
64
- const summary = createSummary(10, 0);
65
- const config: GlobalConfig = {};
66
- expect(determineExitCode(summary, config)).toBe(0);
67
- });
68
-
69
- test('should exit 1 when failures exist and continueOnError is false', () => {
70
- const summary = createSummary(10, 2);
71
- const config: GlobalConfig = {};
72
- expect(determineExitCode(summary, config)).toBe(1);
73
- });
74
-
75
- test('should exit 0 when failures exist and continueOnError is true', () => {
76
- const summary = createSummary(10, 2);
77
- const config: GlobalConfig = { continueOnError: true };
78
- expect(determineExitCode(summary, config)).toBe(0);
79
- });
80
- });
81
-
82
- describe('--strict-exit flag', () => {
83
- test('should exit 1 when strictExit is true and any failures exist', () => {
84
- const summary = createSummary(10, 1);
85
- const config: GlobalConfig = { ci: { strictExit: true } };
86
- expect(determineExitCode(summary, config)).toBe(1);
87
- });
88
-
89
- test('should exit 0 when strictExit is true but no failures', () => {
90
- const summary = createSummary(10, 0);
91
- const config: GlobalConfig = { ci: { strictExit: true } };
92
- expect(determineExitCode(summary, config)).toBe(0);
93
- });
94
-
95
- test('should exit 1 when strictExit is true even with continueOnError', () => {
96
- const summary = createSummary(10, 1);
97
- const config: GlobalConfig = {
98
- continueOnError: true,
99
- ci: { strictExit: true },
100
- };
101
- expect(determineExitCode(summary, config)).toBe(1);
102
- });
103
- });
104
-
105
- describe('--fail-on threshold', () => {
106
- test('should exit 0 when failures are at or below threshold', () => {
107
- const summary = createSummary(10, 2);
108
- const config: GlobalConfig = { ci: { failOn: 2 } };
109
- expect(determineExitCode(summary, config)).toBe(0);
110
- });
111
-
112
- test('should exit 1 when failures exceed threshold', () => {
113
- const summary = createSummary(10, 3);
114
- const config: GlobalConfig = { ci: { failOn: 2 } };
115
- expect(determineExitCode(summary, config)).toBe(1);
116
- });
117
-
118
- test('should exit 0 when failOn is 0 and no failures', () => {
119
- const summary = createSummary(10, 0);
120
- const config: GlobalConfig = { ci: { failOn: 0 } };
121
- expect(determineExitCode(summary, config)).toBe(0);
122
- });
123
-
124
- test('should exit 1 when failOn is 0 and any failures exist', () => {
125
- const summary = createSummary(10, 1);
126
- const config: GlobalConfig = { ci: { failOn: 0 } };
127
- expect(determineExitCode(summary, config)).toBe(1);
128
- });
129
- });
130
-
131
- describe('--fail-on-percentage threshold', () => {
132
- test('should exit 0 when failure percentage is at or below threshold', () => {
133
- const summary = createSummary(100, 10);
134
- const config: GlobalConfig = { ci: { failOnPercentage: 10 } };
135
- expect(determineExitCode(summary, config)).toBe(0);
136
- });
137
-
138
- test('should exit 1 when failure percentage exceeds threshold', () => {
139
- const summary = createSummary(100, 11);
140
- const config: GlobalConfig = { ci: { failOnPercentage: 10 } };
141
- expect(determineExitCode(summary, config)).toBe(1);
142
- });
143
-
144
- test('should exit 0 when failOnPercentage is 50 and failures are 50%', () => {
145
- const summary = createSummary(10, 5);
146
- const config: GlobalConfig = { ci: { failOnPercentage: 50 } };
147
- expect(determineExitCode(summary, config)).toBe(0);
148
- });
149
-
150
- test('should exit 1 when failOnPercentage is 50 and failures are 51%', () => {
151
- const summary = createSummary(100, 51);
152
- const config: GlobalConfig = { ci: { failOnPercentage: 50 } };
153
- expect(determineExitCode(summary, config)).toBe(1);
154
- });
155
-
156
- test('should handle edge case with 0 total requests', () => {
157
- const summary = createSummary(0, 0);
158
- const config: GlobalConfig = { ci: { failOnPercentage: 10 } };
159
- expect(determineExitCode(summary, config)).toBe(0);
160
- });
161
- });
162
-
163
- describe('combined options', () => {
164
- test('strictExit takes precedence over failOn', () => {
165
- const summary = createSummary(10, 1);
166
- const config: GlobalConfig = {
167
- ci: { strictExit: true, failOn: 5 },
168
- };
169
- expect(determineExitCode(summary, config)).toBe(1);
170
- });
171
-
172
- test('strictExit takes precedence over failOnPercentage', () => {
173
- const summary = createSummary(100, 1);
174
- const config: GlobalConfig = {
175
- ci: { strictExit: true, failOnPercentage: 50 },
176
- };
177
- expect(determineExitCode(summary, config)).toBe(1);
178
- });
179
-
180
- test('failOn checked before failOnPercentage', () => {
181
- const summary = createSummary(100, 6); // 6% failure
182
- const config: GlobalConfig = {
183
- ci: { failOn: 5, failOnPercentage: 10 }, // Would pass percentage but fail count
184
- };
185
- expect(determineExitCode(summary, config)).toBe(1);
186
- });
187
-
188
- test('should exit 0 when all thresholds pass', () => {
189
- const summary = createSummary(100, 5); // 5% failure
190
- const config: GlobalConfig = {
191
- ci: { failOn: 5, failOnPercentage: 10 },
192
- };
193
- expect(determineExitCode(summary, config)).toBe(0);
194
- });
195
- });
196
-
197
- describe('CI option with continueOnError', () => {
198
- test('should still respect CI thresholds even with continueOnError', () => {
199
- const summary = createSummary(10, 3);
200
- const config: GlobalConfig = {
201
- continueOnError: true,
202
- ci: { failOn: 2 },
203
- };
204
- expect(determineExitCode(summary, config)).toBe(1);
205
- });
206
-
207
- test('should exit 0 when threshold not exceeded with continueOnError', () => {
208
- const summary = createSummary(10, 2);
209
- const config: GlobalConfig = {
210
- continueOnError: true,
211
- ci: { failOn: 2 },
212
- };
213
- expect(determineExitCode(summary, config)).toBe(0);
214
- });
215
- });
216
- });