+10
-0
@@ -9,2 +9,12 @@ # `tap-arc` Changelog | ||
| ## [0.3.1] - 2022-03-24 | ||
| ### Changed | ||
| - use `strict` instead of `match` from `tcompare` for more verbose diffs | ||
| ### Fixed | ||
| - correctly handle when shallow equality TAP output cannot be diffed | ||
| ## [0.3.0] - 2022-03-23 | ||
@@ -11,0 +21,0 @@ |
+27
-12
@@ -8,3 +8,3 @@ #!/usr/bin/env node | ||
| const through = require('through2') | ||
| const { match } = require('tcompare') | ||
| const { strict } = require('tcompare') | ||
| const { | ||
@@ -88,16 +88,31 @@ blue, | ||
| const compared = match(lhs, rhs, { pretty: true, sort: true }) | ||
| // capture diff after line: "@@ -n,n +n,n @@" | ||
| const diff = compared.diff.split(/^(?:@@).*(?:@@)$/gm)[1] | ||
| const compared = strict( | ||
| lhs, | ||
| rhs, | ||
| { | ||
| includeEnumerable: true, | ||
| includeGetters: true, | ||
| pretty: true, | ||
| sort: true | ||
| } | ||
| ) | ||
| for (const line of diff.split('\n')) { | ||
| const char0 = line.charAt(0) | ||
| if (!compared.match) { | ||
| // capture diff after line: "@@ -n,n +n,n @@" | ||
| const diff = compared.diff.split(/^(?:@@).*(?:@@)$/gm)[1] | ||
| if (char0 === '-') | ||
| msg.push(green(line)) | ||
| else if (char0 === '+') | ||
| msg.push(red(line)) | ||
| else | ||
| msg.push(line) | ||
| for (const line of diff.split('\n')) { | ||
| const char0 = line.charAt(0) | ||
| if (char0 === '-') | ||
| msg.push(green(line)) | ||
| else if (char0 === '+') | ||
| msg.push(red(line)) | ||
| else | ||
| msg.push(line) | ||
| } | ||
| } | ||
| else { | ||
| msg.push(`${red('Expected')} did not match ${green('actual')}.`) | ||
| } | ||
@@ -104,0 +119,0 @@ return msg |
+2
-1
@@ -5,3 +5,3 @@ { | ||
| "author": "tbeseda", | ||
| "version": "0.3.0", | ||
| "version": "0.3.1", | ||
| "license": "Apache-2.0", | ||
@@ -35,2 +35,3 @@ "main": "index.js", | ||
| "tap-arc:diff": "npm run --silent tape:diff | node ./index.js", | ||
| "tap-arc:diff:-v": "npm run --silent tape:diff | node ./index.js -v", | ||
| "tap-arc:passing": "npm run --silent tape:passing | node ./index.js", | ||
@@ -37,0 +38,0 @@ "tap-arc:simple": "npm run --silent tape:simple | node ./index.js", |
+1
-1
| # `tap-arc` | ||
| > A small (~12kB) [TAP](https://testanything.org/) reporter with spec-like output, streaming, and failure diffing. | ||
| > A small (~24kB) [TAP](https://testanything.org/) reporter with spec-like output, streaming, and failure diffing. | ||
@@ -5,0 +5,0 @@ ## Objectives |
23838
2.12%226
6.6%