3.0.6 • Published 3 years ago

assert-no-diff v3.0.6

Weekly downloads
149
License
ISC
Repository
github
Last release
3 years ago

AssertNoDiff

Asserts the equality of JavaScript strings and objects with human-friendly, Bash-colored diffs as error messages.

CircleCI Coverage Status Language grade: JavaScript

This library provides the JavaScript string and object diff methods of the popular diff library as assertions. The exceptions thrown by the assertions highlight the differences of the actual and expected values with human-friendly Bash-colored messages. This is useful for verifying the equality of larger strings or data structures in tests.

const assertNoDiff = require("assert-no-diff")

// assert no differences between two JavaScript objects
assertNoDiff.json(actualJson, expectedJson)

// compare strings and highlight the differences character-by-character
assertNoDiff.chars(actualString, expectedString)

// compare strings and highlight the mismatching words, whitespace-sensitive
assertNoDiff.wordsWithSpace(actualString, expectedString)

// compare strings and highlight the mismatching lines, ignoring whitespace around them
assertNoDiff.trimmedLines(actualString, expectedString)

You can provide a custom error message as an optional third parameter.

Development

  • run all tests: make test
  • see all available make commands: make help
  • deploy a new version:
    • update package.json to the new version and commit to master
    • run npm publish
3.0.6

3 years ago

3.0.5

4 years ago

3.0.4

4 years ago

3.0.3

5 years ago

3.0.2

5 years ago

3.0.1

5 years ago