@small-tech/tap-monkey 1.4.0 → 1.6.0
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/CHANGELOG.md +14 -0
- package/index.js +18 -8
- package/jsconfig.json +14 -0
- package/package.json +7 -7
- package/tests/index.js +17 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.6.0] - 2025-12-29
|
|
8
|
+
|
|
9
|
+
Bail-on-fail monkey.
|
|
10
|
+
|
|
11
|
+
- If you want the process to exit on first failure (e.g., you’re running your unit tests continuously until you hit an unpredictably-reproduced failure), set the `BAIL_ON_FAIL` environment flag before running the tests.
|
|
12
|
+
|
|
13
|
+
## [1.5.0] - 2025-12-29
|
|
14
|
+
|
|
15
|
+
Maintenance monkey.
|
|
16
|
+
|
|
17
|
+
- Update all dependencies.
|
|
18
|
+
- Fix failing test.
|
|
19
|
+
- Remove all vulnerability warnings.
|
|
20
|
+
|
|
7
21
|
## [1.4.0] - 2022-05-24
|
|
8
22
|
|
|
9
23
|
Testy monkey.
|
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
//
|
|
13
13
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
14
14
|
|
|
15
|
-
import
|
|
15
|
+
import ora from 'ora'
|
|
16
16
|
import chalk from 'chalk'
|
|
17
17
|
import { performance } from 'perf_hooks'
|
|
18
18
|
import tapOut from '@small-tech/tap-out'
|
|
@@ -31,16 +31,16 @@ export const context = {
|
|
|
31
31
|
// reflected in the spinner text and that’s ok. Failures, of course, are
|
|
32
32
|
// all output in full to the terminal.
|
|
33
33
|
const indentedMonkey = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
interval: 300,
|
|
35
|
+
frames: [
|
|
36
|
+
' 🙈 ',
|
|
37
|
+
' 🙈 ',
|
|
38
|
+
' 🙉 ',
|
|
39
|
+
' 🙊 '
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const spinner =
|
|
43
|
+
const spinner = ora({
|
|
44
44
|
spinner: indentedMonkey,
|
|
45
45
|
discardStdin: false,
|
|
46
46
|
text: 'Running tests…'
|
|
@@ -88,6 +88,16 @@ const failHandler = (assert => {
|
|
|
88
88
|
console.log(' ', chalk.red(line))
|
|
89
89
|
})
|
|
90
90
|
|
|
91
|
+
if (process.env.BAIL_ON_FAIL) {
|
|
92
|
+
/* c8 ignore next */
|
|
93
|
+
if (!process.env.DONT_ACTUALLY_BAIL_ON_FAIL) {
|
|
94
|
+
/* c8 ignore next */
|
|
95
|
+
process.exit()
|
|
96
|
+
} else {
|
|
97
|
+
return 'I pretended to bail on fail.'
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
91
101
|
spinner.start()
|
|
92
102
|
})
|
|
93
103
|
|
package/jsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"checkJs": true,
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"lib": ["es2024", "dom"],
|
|
6
|
+
"target": "es2024",
|
|
7
|
+
"moduleResolution": "nodenext",
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"allowSyntheticDefaultImports": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"skipLibCheck": true
|
|
12
|
+
},
|
|
13
|
+
"exclude": ["node_modules"]
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@small-tech/tap-monkey",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A tap formatter that’s also a monkey.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tap",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"url": "https://github.com/small-tech/tap-monkey.git"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@small-tech/tap-out": "^3.
|
|
38
|
-
"chalk": "^
|
|
39
|
-
"ora": "^
|
|
37
|
+
"@small-tech/tap-out": "^3.3.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
|
+
"ora": "^9.0.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"c8": "^
|
|
43
|
-
"strip-ansi": "^7.
|
|
44
|
-
"tape": "^5.
|
|
42
|
+
"c8": "^10.1.3",
|
|
43
|
+
"strip-ansi": "^7.1.2",
|
|
44
|
+
"tape": "^5.9.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/tests/index.js
CHANGED
|
@@ -21,11 +21,11 @@ test('test handler', t => {
|
|
|
21
21
|
tapMonkey.testHandler({name: 'mock'})
|
|
22
22
|
tapMonkey.spinner.stop()
|
|
23
23
|
|
|
24
|
-
t.strictEquals(tapMonkey.spinner.
|
|
25
|
-
t.strictEquals(tapMonkey.spinner.
|
|
26
|
-
t.strictEquals(tapMonkey.spinner.
|
|
27
|
-
t.strictEquals(tapMonkey.spinner.
|
|
28
|
-
t.strictEquals(tapMonkey.spinner.
|
|
24
|
+
t.strictEquals(tapMonkey.spinner.interval, 300, 'spinner interval is as expected')
|
|
25
|
+
t.strictEquals(tapMonkey.spinner.spinner.frames[0], ' 🙈 ', 'animation frame 1 is correct')
|
|
26
|
+
t.strictEquals(tapMonkey.spinner.spinner.frames[1], ' 🙈 ', 'animation frame 2 is correct')
|
|
27
|
+
t.strictEquals(tapMonkey.spinner.spinner.frames[2], ' 🙉 ', 'animation frame 3 is correct')
|
|
28
|
+
t.strictEquals(tapMonkey.spinner.spinner.frames[3], ' 🙊 ', 'animation frame 4 is correct')
|
|
29
29
|
|
|
30
30
|
t.true(strip(tapMonkey.spinner.text).includes('Running mock tests'), 'test name is displayed correctly')
|
|
31
31
|
|
|
@@ -106,7 +106,7 @@ test('fail handler', t => {
|
|
|
106
106
|
console.log = originalConsoleLog
|
|
107
107
|
|
|
108
108
|
t.true(output.includes('TypeError: Cannot convert undefined or null to object'), 'output includes main error message')
|
|
109
|
-
t.true(output.includes('
|
|
109
|
+
t.true(output.includes('/var/home/aral/Projects/nodekit/node_modules/tape-promise/node_modules/onetime/index.js:30:12'), 'error location shown')
|
|
110
110
|
|
|
111
111
|
// Test a regular assertion failure.
|
|
112
112
|
|
|
@@ -162,6 +162,17 @@ test('fail handler', t => {
|
|
|
162
162
|
t.true(output.includes('expected: true'), 'output should include expected field')
|
|
163
163
|
t.true(output.includes('actual : false'), 'output should include actual field')
|
|
164
164
|
|
|
165
|
+
// Test bail on fail environment flag.
|
|
166
|
+
process.env.BAIL_ON_FAIL = 'true'
|
|
167
|
+
process.env.DONT_ACTUALLY_BAIL_ON_FAIL = 'true'
|
|
168
|
+
console.log = capturedConsoleLog
|
|
169
|
+
const mockResult = tapMonkey.failHandler(regularFailedAssertion)
|
|
170
|
+
delete process.env.BAIL_ON_FAIL
|
|
171
|
+
delete process.env.DONT_ACTUALLY_BAIL_ON_FAIL
|
|
172
|
+
console.log = originalConsoleLog
|
|
173
|
+
|
|
174
|
+
t.strictEquals(mockResult, 'I pretended to bail on fail.', 'Bail on fail works.')
|
|
175
|
+
|
|
165
176
|
t.end()
|
|
166
177
|
})
|
|
167
178
|
|