@plugjs/expect5 0.4.5 → 0.4.7

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 (35) hide show
  1. package/dist/cli.mjs +1 -1
  2. package/dist/expectation/async.cjs +32 -20
  3. package/dist/expectation/async.cjs.map +1 -1
  4. package/dist/expectation/async.d.ts +51 -11
  5. package/dist/expectation/async.mjs +32 -20
  6. package/dist/expectation/async.mjs.map +1 -1
  7. package/dist/expectation/expect.cjs +3 -3
  8. package/dist/expectation/expect.cjs.map +1 -1
  9. package/dist/expectation/expect.d.ts +3 -3
  10. package/dist/expectation/expect.mjs +4 -4
  11. package/dist/expectation/expect.mjs.map +1 -1
  12. package/dist/expectation/expectations.cjs +27 -44
  13. package/dist/expectation/expectations.cjs.map +1 -1
  14. package/dist/expectation/expectations.d.ts +72 -14
  15. package/dist/expectation/expectations.mjs +27 -44
  16. package/dist/expectation/expectations.mjs.map +1 -1
  17. package/dist/expectation/matchers.cjs +24 -47
  18. package/dist/expectation/matchers.cjs.map +1 -1
  19. package/dist/expectation/matchers.d.ts +136 -93
  20. package/dist/expectation/matchers.mjs +23 -46
  21. package/dist/expectation/matchers.mjs.map +1 -1
  22. package/dist/expectation/types.cjs.map +1 -1
  23. package/dist/expectation/types.d.ts +2 -2
  24. package/dist/expectation/types.mjs.map +1 -1
  25. package/dist/test.cjs +6 -4
  26. package/dist/test.cjs.map +1 -1
  27. package/dist/test.mjs +7 -5
  28. package/dist/test.mjs.map +1 -1
  29. package/package.json +3 -3
  30. package/src/expectation/async.ts +95 -14
  31. package/src/expectation/expect.ts +6 -6
  32. package/src/expectation/expectations.ts +152 -27
  33. package/src/expectation/matchers.ts +207 -125
  34. package/src/expectation/types.ts +2 -2
  35. package/src/test.ts +9 -4
@@ -1,6 +1,6 @@
1
1
  import { type Diff } from './diff'
2
2
  import { type Expectations } from './expectations'
3
- import { type Matchers } from './matchers'
3
+ import { type Matcher } from './matchers'
4
4
 
5
5
  /* ========================================================================== *
6
6
  * INTERNAL TYPES FOR EXPECTATIONS *
@@ -194,7 +194,7 @@ export function prefixType(type: TypeName): string {
194
194
 
195
195
  export const matcherMarker = Symbol.for('plugjs:expect5:types:Matcher')
196
196
 
197
- export function isMatcher(what: any): what is Matchers {
197
+ export function isMatcher(what: any): what is Matcher {
198
198
  return what && what[matcherMarker] === matcherMarker
199
199
  }
200
200
 
package/src/test.ts CHANGED
@@ -6,7 +6,7 @@ import { AssertionError } from 'node:assert'
6
6
  import { BuildFailure } from '@plugjs/plug'
7
7
  import { assert } from '@plugjs/plug/asserts'
8
8
  import { type Files } from '@plugjs/plug/files'
9
- import { $blu, $grn, $gry, $ms, $red, $wht, $ylw, ERROR, NOTICE, WARN, log, type Logger } from '@plugjs/plug/logging'
9
+ import { $blu, $grn, $gry, $ms, $red, $wht, $ylw, ERROR, NOTICE, WARN, log, type Logger, $p } from '@plugjs/plug/logging'
10
10
  import { type Context, type PipeParameters, type Plug } from '@plugjs/plug/pipe'
11
11
 
12
12
  import * as setup from './execution/setup'
@@ -63,7 +63,11 @@ export class Test implements Plug<void> {
63
63
 
64
64
  // Create our _root_ Suite
65
65
  const suite = new Suite(undefined, '', async () => {
66
- for (const file of files.absolutePaths()) await import(file)
66
+ let count = 0
67
+ for (const file of files.absolutePaths()) {
68
+ log.debug('Importing', $p(file), 'in suite', $gry(`(${++ count}/${files.length})`))
69
+ await import(file)
70
+ }
67
71
  })
68
72
 
69
73
  // Setup our suite counts
@@ -234,7 +238,7 @@ function dumpError(log: Logger, error: any, genericErrorDiffs: boolean): void {
234
238
  }
235
239
 
236
240
  function dumpProps(log: Logger, pad: number, error: Error): void {
237
- const keys = Object.keys(error)
241
+ Object.keys(error)
238
242
  .filter((k) => ![
239
243
  'diff', // expectations error,
240
244
  'actual', // assertion error, chai
@@ -244,13 +248,14 @@ function dumpProps(log: Logger, pad: number, error: Error): void {
244
248
  'showDiff', // chai
245
249
  'stack', // error
246
250
  ].includes(k))
251
+ .filter((k) => !(error[k as keyof typeof error] === null))
252
+ .filter((k) => !(error[k as keyof typeof error] === undefined))
247
253
  .forEach((k) => {
248
254
  const value = error[k as keyof typeof error]
249
255
  if ((k === 'code') && (value === 'ERR_ASSERTION')) return
250
256
  const details = typeof value === 'string' ? value : stringifyValue(value)
251
257
  log.error($gry(`${k}:`.padStart(pad - 1)), $ylw(details))
252
258
  })
253
- log.error('KEYS!!!', keys)
254
259
  }
255
260
 
256
261
  function dumpStack(log: Logger, error: Error): void {