Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tap-arc

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tap-arc - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

10

CHANGELOG.md

@@ -9,2 +9,12 @@ # `tap-arc` Changelog

## [0.3.2] - 2022-03-24
### Added
- `--verbose` prints full diff as reported by `tcompare`
### Fixed
- actual vs expected colors in equality assertions
## [0.3.1] - 2022-03-24

@@ -11,0 +21,0 @@

24

index.js

@@ -14,2 +14,3 @@ #!/usr/bin/env node

green,
inverse,
red,

@@ -69,3 +70,4 @@ underline,

function makeDiff (lhs, rhs) {
function makeDiff (lhs, rhs, options) {
const { verbose } = options
const msg = []

@@ -102,11 +104,15 @@ let isJson = true

// capture diff after line: "@@ -n,n +n,n @@"
const diff = compared.diff.split(/^(?:@@).*(?:@@)$/gm)[1]
const diff = verbose
? compared.diff
: compared.diff.split(/^(?:@@).*(?:@@)$/gm)[1]
for (const line of diff.split('\n')) {
const char0 = line.charAt(0)
if (char0 === '-')
if (line.indexOf('--- ') === 0)
msg.push(inverse(red(line)))
else if (line.indexOf('+++ ') === 0)
msg.push(inverse(green(line)))
else if (line.charAt(0) === '-')
msg.push(red(line))
else if (line.charAt(0) === '+')
msg.push(green(line))
else if (char0 === '+')
msg.push(red(line))
else

@@ -165,7 +171,7 @@ msg.push(line)

if (typeof expected === 'string' && typeof actual === 'string') {
msg = [ ...msg, ...makeDiff(actual, expected) ]
msg = [ ...msg, ...makeDiff(actual, expected, options) ]
}
else if (typeof expected === 'object' && typeof actual === 'object') {
// probably an array
msg = [ ...msg, ...makeDiff(actual, expected) ]
msg = [ ...msg, ...makeDiff(actual, expected, options) ]
}

@@ -172,0 +178,0 @@ else if (typeof expected === 'number' || typeof actual === 'number') {

@@ -5,3 +5,3 @@ {

"author": "tbeseda",
"version": "0.3.1",
"version": "0.3.2",
"license": "Apache-2.0",

@@ -8,0 +8,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc