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.
@@ -16,7 +16,7 @@ jobs:
16
16
 
17
17
  strategy:
18
18
  matrix:
19
- node-version: [18.x, 20.x, 21.x, 22.x]
19
+ node-version: [18.x, 20.x, 21.x, 22.x, 23.x]
20
20
  os: [ubuntu-latest, windows-latest]
21
21
  exclude:
22
22
  - os: windows-latest
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 parsed = await glob(files[i].replace(/^['"]/, '').replace(/['"]$/, ''), { ignore, cwd, windowsPathsNoEscape: true })
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.18.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/**/*\" --coverage --coverage-exclude \"fixtures/**/*\" --coverage-exclude \"test*/**/*\"",
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('tests 2') >= 0, true)
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 () => {
@@ -22,7 +22,7 @@ test('coverage', async () => {
22
22
  test('coverage excludes', async () => {
23
23
  const res = await execa('node', [
24
24
  borp,
25
- '--coverage',
25
+ '-C',
26
26
  '--coverage-exclude=src'
27
27
  ], {
28
28
  cwd: join(import.meta.url, '..', 'fixtures', 'ts-esm')
@@ -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 v22
10
- const skip = process.platform === 'darwin' && process.version.startsWith('v22')
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 })