cno-bedrock 0.1.0 → 0.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.
@@ -1,5 +1,5 @@
1
1
  name: ci
2
- 'on':
2
+ on:
3
3
  - push
4
4
  - pull_request
5
5
  jobs:
@@ -11,20 +11,18 @@ jobs:
11
11
  - macos-latest
12
12
  - windows-latest
13
13
  node:
14
- - '18'
15
- - '20'
16
14
  - latest
15
+ - lts/*
17
16
  name: source-${{matrix.os}}-node-${{matrix.node}}
18
17
  runs-on: ${{matrix.os}}
19
18
  steps:
20
- - uses: actions/checkout@v4.1.1
21
- - uses: actions/setup-node@v4.0.2
19
+ - uses: actions/checkout@v7
20
+ - uses: actions/setup-node@v7
22
21
  with:
23
22
  node-version: ${{matrix.node}}
24
- - uses: pnpm/action-setup@v3.0.0
23
+ - uses: pnpm/action-setup@v6.1.1
25
24
  with:
26
- version: '8'
27
- if: ${{ matrix.node >= 18 || matrix.node == 'latest' }}
25
+ version: latest
28
26
  - run: pnpm install
29
27
  - run: pnpm test
30
28
  coverage:
@@ -32,16 +30,16 @@ jobs:
32
30
  name: coverage-ubuntu-latest-node-latest
33
31
  runs-on: ubuntu-latest
34
32
  steps:
35
- - uses: actions/checkout@v4.1.1
36
- - uses: actions/setup-node@v4.0.2
33
+ - uses: actions/checkout@v7
34
+ - uses: actions/setup-node@v7
37
35
  with:
38
36
  node-version: latest
39
- - uses: pnpm/action-setup@v3.0.0
37
+ - uses: pnpm/action-setup@v6.1.1
40
38
  with:
41
- version: '8'
39
+ version: latest
42
40
  - run: pnpm install
43
41
  - run: pnpm do-ci
44
- - uses: coverallsapp/github-action@v2.2.3
42
+ - uses: coverallsapp/github-action@v2.3.8
45
43
  with:
46
44
  github-token: ${{secrets.GITHUB_TOKEN}}
47
45
  file: coverage/lcov.txt
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.1](https://github.com/Anadian/cno-bedrock/compare/v0.1.0...v0.1.1) (2026-11-29)
6
+
7
+
8
+ ### Features
9
+
10
+ * Added LessThanOrEqual and GreaterThanOrEqual to asserts. ([80878a2](https://github.com/Anadian/cno-bedrock/commit/80878a2a16c3514996be6f26d4f12519491c70eb))
11
+
12
+
13
+ ### Chores
14
+
15
+ * Updated GitHub Actions. ([14defe8](https://github.com/Anadian/cno-bedrock/commit/14defe8ccda7aabc351e0709c04b0df75058e53e))
16
+ * Updated GitHub Actions. ([190d917](https://github.com/Anadian/cno-bedrock/commit/190d917e74abf7c6d9f3334595a3f8e3a7fb2413))
17
+
5
18
  ## [0.1.0](https://github.com/Anadian/cno-bedrock/compare/v0.0.5...v0.1.0) (2026-11-29)
6
19
 
7
20
 
@@ -6,25 +6,24 @@
6
6
  strategy: {
7
7
  matrix: {
8
8
  os: ['ubuntu-latest', 'macos-latest', 'windows-latest'],
9
- node: [ '18', '20', 'latest' ]
9
+ node: [ 'latest', 'lts/*' ]
10
10
  }
11
11
  },
12
12
  name: 'source-${{matrix.os}}-node-${{matrix.node}}',
13
13
  'runs-on': '${{matrix.os}}',
14
14
  steps: [
15
- { uses: 'actions/checkout@v4.1.1' },
15
+ { uses: 'actions/checkout@v7' },
16
16
  {
17
- uses: 'actions/setup-node@v4.0.2',
17
+ uses: 'actions/setup-node@v7',
18
18
  with: {
19
19
  'node-version': '${{matrix.node}}'
20
20
  }
21
21
  },
22
22
  {
23
- uses: 'pnpm/action-setup@v3.0.0',
23
+ uses: 'pnpm/action-setup@v6.1.1',
24
24
  with: {
25
- version: '8'
25
+ version: 'latest'
26
26
  },
27
- if: "${{ matrix.node >= 18 || matrix.node == 'latest' }}"
28
27
  },
29
28
  {
30
29
  run: 'pnpm install'
@@ -39,17 +38,17 @@
39
38
  name: 'coverage-ubuntu-latest-node-latest',
40
39
  'runs-on': 'ubuntu-latest',
41
40
  steps: [
42
- { uses: 'actions/checkout@v4.1.1' },
41
+ { uses: 'actions/checkout@v7' },
43
42
  {
44
- uses: 'actions/setup-node@v4.0.2',
43
+ uses: 'actions/setup-node@v7',
45
44
  with: {
46
45
  'node-version': 'latest'
47
46
  }
48
47
  },
49
48
  {
50
- uses: 'pnpm/action-setup@v3.0.0',
49
+ uses: 'pnpm/action-setup@v6.1.1',
51
50
  with: {
52
- version: '8'
51
+ version: 'latest'
53
52
  },
54
53
  },
55
54
  {
@@ -59,7 +58,7 @@
59
58
  run: 'pnpm do-ci'
60
59
  },
61
60
  {
62
- uses: 'coverallsapp/github-action@v2.2.3',
61
+ uses: 'coverallsapp/github-action@v2.3.8',
63
62
  with: {
64
63
  "github-token": '${{secrets.GITHUB_TOKEN}}',
65
64
  "file": 'coverage/lcov.txt',
package/package.json CHANGED
@@ -1,117 +1,117 @@
1
1
  {
2
- "name": "cno-bedrock",
3
- "version": "0.1.0",
4
- "description": "Micropackage: a test bed for various small pieces of reusable code.",
5
- "repository": {
6
- "type": "git",
7
- "url": "git+https://github.com/Anadian/cno-bedrock.git"
8
- },
9
- "author": "Anadian",
10
- "license": "MIT",
11
- "type": "module",
12
- "exports": {
13
- ".": "./src/lib.js"
14
- },
15
- "engines": {
16
- "node": ">=18"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/Anadian/cno-bedrock/issues"
20
- },
21
- "homepage": "https://github.com/Anadian/cno-bedrock#readme",
22
- "keywords": [
23
- "cno",
24
- "framework",
25
- "minimal",
26
- "essential",
27
- "micro",
28
- "micropackage",
29
- "libre",
30
- "free",
31
- "open",
32
- "mit"
33
- ],
34
- "scripts": {
35
- "test": "node --test ./src/*.test.js",
36
- "coverage": "c8 pnpm test",
37
- "coverage-report": "c8 report -r=text-lcov > coverage/lcov.txt",
38
- "do-ci": "pnpm coverage && pnpm coverage-report",
39
- "lint": "eslint ./src/main.js",
40
- "generate-docs": "scripts/generate-docs.js",
41
- "update-config": "hjson -j ci/github-actions.hjson | json2yaml -o .github/workflows/ci.yml && git change 'chore: Updated GitHub Actions.'",
42
- "update-deps": "npm-check-updates -u",
43
- "release": "standard-version",
44
- "publish-release": "git push --follow-tags origin main && pnpm publish"
45
- },
46
- "standard-version": {
47
- "types": [
48
- {
49
- "type": "build",
50
- "section": "Build",
51
- "hidden": false
52
- },
53
- {
54
- "type": "ci",
55
- "section": "Continuous Integration",
56
- "hidden": false
57
- },
58
- {
59
- "type": "chore",
60
- "section": "Chores",
61
- "hidden": false
62
- },
63
- {
64
- "type": "docs",
65
- "section": "Documentation",
66
- "hidden": false
67
- },
68
- {
69
- "type": "feat",
70
- "section": "Features",
71
- "hidden": false
72
- },
73
- {
74
- "type": "fix",
75
- "section": "Bug Fixes",
76
- "hidden": false
77
- },
78
- {
79
- "type": "perf",
80
- "section": "Performance",
81
- "hidden": false
82
- },
83
- {
84
- "type": "refactor",
85
- "section": "Refactoring",
86
- "hidden": false
87
- },
88
- {
89
- "type": "style",
90
- "section": "Code Style",
91
- "hidden": false
92
- },
93
- {
94
- "type": "test",
95
- "section": "Tests",
96
- "hidden": false
97
- }
98
- ]
99
- },
100
- "bin": {
101
- "cno-bedrock": "./src/cli.js"
102
- },
103
- "devDependencies": {
104
- "c8": "^12.0.0",
105
- "eslint": "^10.8.1",
106
- "extract-documentation-comments": "^0.4.2",
107
- "hjson": "^3.2.2",
108
- "npm-check-updates": "^23.0.2",
109
- "shelljs": "^0.10.0",
110
- "standard-version": "^9.5.0"
111
- },
112
- "dependencies": {
113
- "lodash": "^4.18.1",
114
- "mathjs": "^15.2.0",
115
- "nanoid": "^6.0.1"
116
- }
117
- }
2
+ "name": "cno-bedrock",
3
+ "version": "0.1.1",
4
+ "description": "Micropackage: a test bed for various small pieces of reusable code.",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/Anadian/cno-bedrock.git"
8
+ },
9
+ "author": "Anadian",
10
+ "license": "MIT",
11
+ "type": "module",
12
+ "exports": {
13
+ ".": "./src/lib.js"
14
+ },
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/Anadian/cno-bedrock/issues"
20
+ },
21
+ "homepage": "https://github.com/Anadian/cno-bedrock#readme",
22
+ "keywords": [
23
+ "cno",
24
+ "framework",
25
+ "minimal",
26
+ "essential",
27
+ "micro",
28
+ "micropackage",
29
+ "libre",
30
+ "free",
31
+ "open",
32
+ "mit"
33
+ ],
34
+ "standard-version": {
35
+ "types": [
36
+ {
37
+ "type": "build",
38
+ "section": "Build",
39
+ "hidden": false
40
+ },
41
+ {
42
+ "type": "ci",
43
+ "section": "Continuous Integration",
44
+ "hidden": false
45
+ },
46
+ {
47
+ "type": "chore",
48
+ "section": "Chores",
49
+ "hidden": false
50
+ },
51
+ {
52
+ "type": "docs",
53
+ "section": "Documentation",
54
+ "hidden": false
55
+ },
56
+ {
57
+ "type": "feat",
58
+ "section": "Features",
59
+ "hidden": false
60
+ },
61
+ {
62
+ "type": "fix",
63
+ "section": "Bug Fixes",
64
+ "hidden": false
65
+ },
66
+ {
67
+ "type": "perf",
68
+ "section": "Performance",
69
+ "hidden": false
70
+ },
71
+ {
72
+ "type": "refactor",
73
+ "section": "Refactoring",
74
+ "hidden": false
75
+ },
76
+ {
77
+ "type": "style",
78
+ "section": "Code Style",
79
+ "hidden": false
80
+ },
81
+ {
82
+ "type": "test",
83
+ "section": "Tests",
84
+ "hidden": false
85
+ }
86
+ ]
87
+ },
88
+ "bin": {
89
+ "cno-bedrock": "./src/cli.js"
90
+ },
91
+ "devDependencies": {
92
+ "c8": "^12.0.0",
93
+ "eslint": "^10.8.1",
94
+ "extract-documentation-comments": "^0.4.2",
95
+ "hjson": "^3.2.2",
96
+ "npm-check-updates": "^23.0.2",
97
+ "shelljs": "^0.10.0",
98
+ "standard-version": "^9.5.0"
99
+ },
100
+ "dependencies": {
101
+ "lodash": "^4.18.1",
102
+ "mathjs": "^15.2.0",
103
+ "nanoid": "^6.0.1"
104
+ },
105
+ "scripts": {
106
+ "test": "node --test ./src/*.test.js",
107
+ "coverage": "c8 pnpm test",
108
+ "coverage-report": "c8 report -r=text-lcov > coverage/lcov.txt",
109
+ "do-ci": "pnpm coverage && pnpm coverage-report",
110
+ "lint": "eslint ./src/main.js",
111
+ "generate-docs": "scripts/generate-docs.js",
112
+ "update-config": "hjson -j ci/github-actions.hjson | json2yaml -o .github/workflows/ci.yml && git change 'chore: Updated GitHub Actions.'",
113
+ "update-deps": "npm-check-updates -u",
114
+ "release": "standard-version",
115
+ "publish-release": "git push --follow-tags origin main && pnpm publish"
116
+ }
117
+ }
package/src/cno-assert.js CHANGED
@@ -131,7 +131,7 @@ export function assertNumber( actual ){
131
131
  #### Throws
132
132
  | code | type | condition |
133
133
  | --- | --- | --- |
134
- | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `actual >= expected`. |
134
+ | 'ERR_ASSERTION_LESSTHAN' | AssertionError | Thrown if `actual >= expected`. |
135
135
 
136
136
  #### History
137
137
  | version | change |
@@ -156,6 +156,43 @@ export function assertLessThan( actual, expected ){
156
156
  }
157
157
  } // assertLessThan
158
158
  /**
159
+ ### assertLessThanOrEqual
160
+ > Throws if actual is not less than or equal to expected or if either isn't a number.
161
+
162
+ #### Parametres
163
+ | name | type | description |
164
+ | --- | --- | --- |
165
+ | actual | any | The actual value. |
166
+ | expected | any | The expected value. |
167
+
168
+ #### Throws
169
+ | code | type | condition |
170
+ | --- | --- | --- |
171
+ | 'ERR_ASSERTION_LESSTHANOREQUAL' | AssertionError | Thrown if `actual > expected`. |
172
+
173
+ #### History
174
+ | version | change |
175
+ | --- | --- |
176
+ | 0.1.1 | WIP |
177
+ */
178
+ export function assertLessThanOrEqual( actual, expected ){
179
+ // Constants
180
+ const FUNCTION_NAME = 'assertLessThanOrEqual';
181
+ // Variables
182
+ var return_error = null;
183
+ var message = '';
184
+ // Function
185
+ assertNumber( actual );
186
+ assertNumber( expected );
187
+ if( actual > expected ){
188
+ message = `'actual' (${actual}) is not less than or equal to 'expected' (${expected}).`;
189
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: expected, operator: 'LessThanOrEqual' } );
190
+ return_error.code += '_LESSTHANOREQUAL';
191
+ annotateThis.call( return_error );
192
+ throw return_error;
193
+ }
194
+ } // assertLessThanOrEqual
195
+ /**
159
196
  ### assertGreaterThan
160
197
  > Throws if actual is not greater than expected or if either isn't a number.
161
198
 
@@ -168,7 +205,7 @@ export function assertLessThan( actual, expected ){
168
205
  #### Throws
169
206
  | code | type | condition |
170
207
  | --- | --- | --- |
171
- | 'ERR_ASSERTION_SAMETYPE' | AssertionError | Thrown if `actual <= expected`. |
208
+ | 'ERR_ASSERTION_GREATERTHAN' | AssertionError | Thrown if `actual <= expected`. |
172
209
 
173
210
  #### History
174
211
  | version | change |
@@ -193,6 +230,43 @@ export function assertGreaterThan( actual, expected ){
193
230
  }
194
231
  } // assertGreaterThan
195
232
  /**
233
+ ### assertGreaterThanOrEqual
234
+ > Throws if actual is not greater than or equal to expected or if either isn't a number.
235
+
236
+ #### Parametres
237
+ | name | type | description |
238
+ | --- | --- | --- |
239
+ | actual | any | The actual value. |
240
+ | expected | any | The expected value. |
241
+
242
+ #### Throws
243
+ | code | type | condition |
244
+ | --- | --- | --- |
245
+ | 'ERR_ASSERTION_GREATERTHANOREQUAL' | AssertionError | Thrown if `actual < expected`. |
246
+
247
+ #### History
248
+ | version | change |
249
+ | --- | --- |
250
+ | 0.1.1 | WIP |
251
+ */
252
+ export function assertGreaterThanOrEqual( actual, expected ){
253
+ // Constants
254
+ const FUNCTION_NAME = 'assertGreaterThanOrEqual';
255
+ // Variables
256
+ var return_error = null;
257
+ var message = '';
258
+ // Function
259
+ assertNumber( actual );
260
+ assertNumber( expected );
261
+ if( actual < expected ){
262
+ message = `'actual' (${actual}) is not greater than or equal to 'expected' (${expected}).`;
263
+ return_error = new AssertNS.AssertionError( { message: message, actual: actual, expected: expected, operator: 'GreaterThanOrEqual' } );
264
+ return_error.code += '_GREATERTHANOREQUAL';
265
+ annotateThis.call( return_error );
266
+ throw return_error;
267
+ }
268
+ } // assertGreaterThanOrEqual
269
+ /**
196
270
  ### assertSameType
197
271
  > Throws if actual's type is not the same as expected's, according to a strict `typeof` comparison.
198
272
 
@@ -371,7 +445,7 @@ export function assertIsNullOrEmpty( actual ){
371
445
  } // assertIsNullOrEmpty
372
446
  /**
373
447
  ### assertStrictlyNotEqual
374
- > Throws if actual is not the same type as expected or is the value as expected.
448
+ > Throws if actual is not the same type as expected or is the same value as expected.
375
449
 
376
450
  #### Parametres
377
451
  | name | type | description |
@@ -624,10 +698,18 @@ Object.defineProperties( NAMESPACE, {
624
698
  value: assertLessThan,
625
699
  enumerable: true
626
700
  },
701
+ assertLessThanOrEqual: {
702
+ value: assertLessThanOrEqual,
703
+ enumerable: true
704
+ },
627
705
  assertGreaterThan: {
628
706
  value: assertGreaterThan,
629
707
  enumerable: true
630
708
  },
709
+ assertGreaterThanOrEqual: {
710
+ value: assertGreaterThanOrEqual,
711
+ enumerable: true
712
+ },
631
713
  assertSameType: {
632
714
  value: assertSameType,
633
715
  enumerable: true
@@ -39,6 +39,7 @@ Documentation License: [![Creative Commons License](https://i.creativecommons.or
39
39
  import FSNS from 'node:fs/promises';
40
40
  import PathNS from 'node:path';
41
41
  import OSNS from 'node:os';
42
+ import URLNS from 'node:url';
42
43
  //## External
43
44
 
44
45
  //# Constants
@@ -220,13 +221,13 @@ TestNS.test( 'getHJSONFromObject', async function( t ){
220
221
  name: 'success',
221
222
  success: true,
222
223
  args: [ { a: true } ],
223
- expected: '{\n\t"a": true\n}'
224
+ expected: `{${OSNS.EOL}\t"a": true${OSNS.EOL}}`
224
225
  } );
225
226
  tm.addCondition( {
226
227
  name: 'success-custom-options',
227
228
  success: true,
228
229
  args: [ { a: 1 }, { bracesSameLine: true, quotes: 'all', separator: true, space: '\t' } ],
229
- expected: '{\n\t"a": 1\n}'
230
+ expected: `{${OSNS.EOL}\t"a": 1${OSNS.EOL}}`
230
231
  } );
231
232
  await tm.run();
232
233
  } );
@@ -286,6 +287,10 @@ TestNS.test( 'getUnixTypeFromStatObject', async function( t ){
286
287
  [ 'S_IFLNK', 'symbolic-link' ],
287
288
  [ 'S_IFSOCK', 'socket' ]
288
289
  ] ){
290
+ // Some `S_IF*` constants are not defined on Windows; skip those.
291
+ if( FSNS.constants[flag_name] === undefined ){
292
+ continue;
293
+ }
289
294
  tm.addCondition( {
290
295
  name: flag_name,
291
296
  success: true,
@@ -370,8 +375,8 @@ TestNS.test( 'getDirectoryFromPath', async function( t ){
370
375
  tm.addFunction( { name: 'defaultExport', func: defaultExport.getDirectoryFromPath } );
371
376
  tm.addFunction( { name: 'namespaceExport', func: namespaceExport.getDirectoryFromPath } );
372
377
  tm.addCondition( { name: 'null', success: true, args: [], expected: PathNS.dirname( PathNS.normalize( '..' ) ) } );
373
- tm.addCondition( { name: 'simple', success: true, args: [ '/tmp/foo/bar.txt' ], expected: '/tmp/foo' } );
374
- tm.addCondition( { name: 'unnormalised', success: true, args: [ '/tmp/foo/../bar.txt' ], expected: '/tmp' } );
378
+ tm.addCondition( { name: 'simple', success: true, args: [ '/tmp/foo/bar.txt' ], expected: PathNS.dirname( PathNS.normalize( '/tmp/foo/bar.txt' ) ) } );
379
+ tm.addCondition( { name: 'unnormalised', success: true, args: [ '/tmp/foo/../bar.txt' ], expected: PathNS.dirname( PathNS.normalize( '/tmp/foo/../bar.txt' ) ) } );
375
380
  await tm.run();
376
381
  } );
377
382
  TestNS.test( 'getPathFromRoot', async function( t ){
@@ -563,7 +568,7 @@ TestNS.test( 'TreeItem', async function( t ){
563
568
  AssertNS.deepStrictEqual( item.name, 'thing' );
564
569
  AssertNS.deepStrictEqual( item.relativePath, '/tmp/thing' );
565
570
  AssertNS.deepStrictEqual( item.absolutePath, PathNS.resolve( '/tmp/thing' ) );
566
- AssertNS.deepStrictEqual( item.url.href, new URL( `file://${PathNS.resolve( '/tmp/thing' )}` ).href );
571
+ AssertNS.deepStrictEqual( item.url.href, URLNS.pathToFileURL( PathNS.resolve( '/tmp/thing' ) ).href );
567
572
  AssertNS.deepStrictEqual( item.children, [] );
568
573
  // A `path` alone derives the name from the path's basename.
569
574
  AssertNS.deepStrictEqual( defaultExport.TreeItem( { path: '/tmp/thing.txt' } ).name, 'thing.txt' );
@@ -582,7 +587,7 @@ TestNS.test( 'TreeItem', async function( t ){
582
587
  AssertNS.deepStrictEqual( explicit.size, 5 );
583
588
  // Setting `absolutePath` invalidates the cached `url`, forcing it to be re-derived.
584
589
  explicit.absolutePath = '/other';
585
- AssertNS.deepStrictEqual( explicit.url.href, new URL( 'file:///other' ).href );
590
+ AssertNS.deepStrictEqual( explicit.url.href, URLNS.pathToFileURL( PathNS.resolve( '/other' ) ).href );
586
591
  // `size` falls back to the stat object's `size`.
587
592
  var with_stat = defaultExport.TreeItem( { statObject: { mode: FSNS.constants.S_IFREG, size: 42 } } );
588
593
  AssertNS.deepStrictEqual( with_stat.unixType, 'file' );
@@ -652,6 +657,7 @@ TestNS.test( 'TreeItem.prototype.stat/hash', async function( t ){
652
657
  }
653
658
  } );
654
659
  TestNS.test( 'TreeItem.prototype.processAsync', async function( t ){
660
+ var return_error = null;
655
661
  await createFixture();
656
662
  try{
657
663
  // Non-recursive processing stats only the root.
@@ -676,9 +682,19 @@ TestNS.test( 'TreeItem.prototype.processAsync', async function( t ){
676
682
  containsOnlyNames( findChildByName( excluded_root, 'sub' ), [ 'c.bin', 'nested' ] );
677
683
  containsOnlyNames( findChildByName( findChildByName( excluded_root, 'sub' ), 'nested' ), [] );
678
684
  // Excluding by root-relative path also works.
679
- var path_excluded_root = defaultExport.TreeItem( { path: FIXTURE.path } );
680
- await path_excluded_root.processAsync( { recursive: true, rootPath: FIXTURE.path, excludeRegExpArray: [ /sub\/nested/ ] } );
681
- containsOnlyNames( findChildByName( path_excluded_root, 'sub' ), [ 'c.bin' ] );
685
+ var path_excluded_root = [];
686
+ var exclude_path = '';
687
+ var exclude_regexp = null;
688
+ try{
689
+ path_excluded_root = defaultExport.TreeItem( { path: FIXTURE.path } );
690
+ exclude_path = PathNS.join( 'sub', 'nested' );
691
+ exclude_regexp = new RegExp( exclude_path.replace( /[.*+?^${}()|[\]\\]/g, '\\$&' ) );
692
+ await path_excluded_root.processAsync( { recursive: true, rootPath: FIXTURE.path, excludeRegExpArray: [ exclude_regexp ] } );
693
+ containsOnlyNames( findChildByName( path_excluded_root, 'sub' ), [ 'c.bin' ] );
694
+ } catch( error ){
695
+ return_error = new Error( `For path_excluded_root=${path_excluded_root} exclude_path=${exclude_path} exclude_regexp=${exclude_regexp}, caught error: ${error}`, { cause: error } );
696
+ throw return_error;
697
+ }
682
698
  // `maxDepth` limits descent: children are listed, descendants aren't.
683
699
  var depth_root = defaultExport.TreeItem( { path: FIXTURE.path } );
684
700
  await depth_root.processAsync( { recursive: true, maxDepth: 1 } );
@@ -762,7 +778,7 @@ TestNS.test( 'TreeItem.prototype.aggregate', async function( t ){
762
778
  sorted_root.aggregate( { sortBySize: true } );
763
779
  for( const node of [ sorted_root, findChildByName( sorted_root, 'sub' ) ] ){
764
780
  for( var index = 1; index < node.children.length; index++ ){
765
- AssertNS.ok( node.children[index - 1].totalSize >= node.children[index].totalSize );
781
+ AssertNS.assertTruthy( node.children[index - 1].totalSize >= node.children[index].totalSize );
766
782
  }
767
783
  }
768
784
  } finally{
@@ -802,7 +818,7 @@ TestNS.test( 'dirstat', async function( t ){
802
818
  containsOnlyNames( root, [ 'a.txt', 'b.txt', 'link.txt', 'empty', 'sub' ] );
803
819
  containsOnlyNames( findChildByName( findChildByName( root, 'sub' ), 'nested' ), [ 'd.txt' ] );
804
820
  AssertNS.deepStrictEqual( findChildByName( root, 'a.txt' ).size, FIXTURE.sizes['a.txt'] );
805
- AssertNS.ok( findChildByName( root, 'sub' ).size < FIXTURE.directorySizeUpperBound );
821
+ AssertNS.assertLessThanOrEqual( findChildByName( root, 'sub' ).size, FIXTURE.directorySizeUpperBound );
806
822
  // Symlinks are followed by default.
807
823
  AssertNS.deepStrictEqual( findChildByName( root, 'link.txt' ).unixType, 'file' );
808
824
  AssertNS.deepStrictEqual( findChildByName( root, 'link.txt' ).size, FIXTURE.sizes['a.txt'] );
@@ -837,7 +853,7 @@ TestNS.test( 'dirstat', async function( t ){
837
853
  // `sortBySize` orders children largest-first.
838
854
  var sorted = await defaultExport.dirstat( { path: FIXTURE.path, sortBySize: true } );
839
855
  for( var index = 1; index < sorted.children.length; index++ ){
840
- AssertNS.ok( sorted.children[index - 1].totalSize >= sorted.children[index].totalSize );
856
+ AssertNS.assertTruthy( sorted.children[index - 1].totalSize >= sorted.children[index].totalSize );
841
857
  }
842
858
  // A single file can be processed as its own root.
843
859
  var file_root = await defaultExport.dirstat( { path: PathNS.join( FIXTURE.path, 'a.txt' ) } );