borp 0.18.0 → 0.19.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/.github/workflows/ci.yml +1 -1
- package/README.md +6 -0
- package/lib/run.js +14 -1
- package/package.json +3 -2
- package/test/cli.test.js +18 -1
- package/test/coverage.test.js +1 -1
- package/test/watch.test.js +3 -2
package/.github/workflows/ci.yml
CHANGED
package/README.md
CHANGED
|
@@ -27,6 +27,9 @@ borp --reporter foo:stderr
|
|
|
27
27
|
|
|
28
28
|
# with a local custom reporter
|
|
29
29
|
borp --reporter ./lib/some-reporter.mjs
|
|
30
|
+
|
|
31
|
+
# matching all test.js files except ones in nested node_modules directories
|
|
32
|
+
borp 'test/**/*.test.js' '!test/**/node_modules/**/*.test.js'
|
|
30
33
|
```
|
|
31
34
|
|
|
32
35
|
Borp will automatically run all tests files matching `*.test.{js|ts}`.
|
|
@@ -137,6 +140,9 @@ full path to some yaml file.
|
|
|
137
140
|
The current supported options are:
|
|
138
141
|
|
|
139
142
|
+ `files` (string[]): An array of test files to include. Globs are supported.
|
|
143
|
+
Note: any glob that starts with a `!` (bang character) will be treated as
|
|
144
|
+
an ignore glob, e.g. `'!test/**/node_modules/**/*'` will ignore all files
|
|
145
|
+
in nested `node_modules` directories that would otherwise be matched.
|
|
140
146
|
+ `reporters` (string[]): An array of reporters to use. May be relative path
|
|
141
147
|
strings, or module name strings.
|
|
142
148
|
|
package/lib/run.js
CHANGED
|
@@ -196,15 +196,27 @@ export default async function runWithTypeScript (config) {
|
|
|
196
196
|
if (prefix) {
|
|
197
197
|
files = files.map((file) => join(prefix, file.replace(/ts$/, 'js')))
|
|
198
198
|
}
|
|
199
|
+
|
|
199
200
|
const expandedFiles = []
|
|
201
|
+
const globs = []
|
|
200
202
|
for (let i = 0; i < files.length; i += 1) {
|
|
201
203
|
if (files[i].includes('*') === false) {
|
|
202
204
|
expandedFiles.push(files[i])
|
|
203
205
|
continue
|
|
204
206
|
}
|
|
205
|
-
const
|
|
207
|
+
const pattern = files[i].replace(/^['"]/, '').replace(/['"]$/, '')
|
|
208
|
+
if (pattern[0] === '!') {
|
|
209
|
+
ignore.push(pattern.slice(1))
|
|
210
|
+
continue
|
|
211
|
+
}
|
|
212
|
+
globs.push(pattern)
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (globs.length > 0) {
|
|
216
|
+
const parsed = await glob(globs, { ignore, cwd, windowsPathsNoEscape: true })
|
|
206
217
|
Array.prototype.push.apply(expandedFiles, parsed)
|
|
207
218
|
}
|
|
219
|
+
|
|
208
220
|
files = expandedFiles
|
|
209
221
|
} else if (config.pattern) {
|
|
210
222
|
let pattern = config.pattern
|
|
@@ -221,6 +233,7 @@ export default async function runWithTypeScript (config) {
|
|
|
221
233
|
|
|
222
234
|
config.files = files
|
|
223
235
|
|
|
236
|
+
config.coverage = false
|
|
224
237
|
stream = run(config)
|
|
225
238
|
|
|
226
239
|
stream.on('close', () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "borp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "node:test wrapper with TypeScript support",
|
|
6
6
|
"main": "borp.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"scripts": {
|
|
15
15
|
"clean": "rm -rf fixtures/*/dist .test-*",
|
|
16
16
|
"lint": "standard | snazzy",
|
|
17
|
-
"unit": "node borp.js --ignore \"fixtures/**/*\"
|
|
17
|
+
"unit": "node borp.js --ignore \"fixtures/**/*\" -C --coverage-exclude \"fixtures/**/*\" --coverage-exclude \"test*/**/*\"",
|
|
18
18
|
"test": "npm run clean ; npm run lint && npm run unit"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [],
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"@sinonjs/fake-timers": "^13.0.2",
|
|
27
27
|
"@types/node": "^22.2.0",
|
|
28
28
|
"desm": "^1.3.0",
|
|
29
|
+
"semver": "^7.6.3",
|
|
29
30
|
"snazzy": "^9.0.0",
|
|
30
31
|
"standard": "^17.1.0",
|
|
31
32
|
"typescript": "^5.3.2"
|
package/test/cli.test.js
CHANGED
|
@@ -112,7 +112,24 @@ test('interprets globs for files', async () => {
|
|
|
112
112
|
cwd
|
|
113
113
|
})
|
|
114
114
|
|
|
115
|
-
strictEqual(stdout.indexOf('
|
|
115
|
+
strictEqual(stdout.indexOf('✔ add') >= 0, true)
|
|
116
|
+
strictEqual(stdout.indexOf('✔ add2') >= 0, true)
|
|
117
|
+
strictEqual(stdout.indexOf('✔ a thing'), -1)
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('interprets globs for files with an ignore rule', async () => {
|
|
121
|
+
const cwd = join(import.meta.url, '..', 'fixtures', 'files-glob')
|
|
122
|
+
const { stdout } = await execa('node', [
|
|
123
|
+
borp,
|
|
124
|
+
'\'**/*.test.js\'',
|
|
125
|
+
'\'!test1/**/node_modules/**/*\''
|
|
126
|
+
], {
|
|
127
|
+
cwd
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
strictEqual(stdout.indexOf('✔ add') >= 0, true)
|
|
131
|
+
strictEqual(stdout.indexOf('✔ add2') >= 0, true)
|
|
132
|
+
strictEqual(stdout.indexOf('✔ a thing'), -1)
|
|
116
133
|
})
|
|
117
134
|
|
|
118
135
|
test('Post compile script should be executed when --post-compile is sent with esm', async () => {
|
package/test/coverage.test.js
CHANGED
package/test/watch.test.js
CHANGED
|
@@ -5,9 +5,10 @@ import { join } from 'desm'
|
|
|
5
5
|
import { mkdtemp, cp, writeFile, rm } from 'node:fs/promises'
|
|
6
6
|
import path from 'node:path'
|
|
7
7
|
import { once } from 'node:events'
|
|
8
|
+
import semver from 'semver'
|
|
8
9
|
|
|
9
|
-
// These tests are currently broken on node
|
|
10
|
-
const skip = process.platform === 'darwin' && process.version.
|
|
10
|
+
// These tests are currently broken on some node versions
|
|
11
|
+
const skip = process.platform === 'darwin' && semver.satisfies(process.version, '>=20.16.0 <22.10.0')
|
|
11
12
|
|
|
12
13
|
test('watch', { skip }, async (t) => {
|
|
13
14
|
const { strictEqual, completed, match } = tspl(t, { plan: 3 })
|