jsdiff-console

Compares JS hashes using JsDiff and outputs the result on the console

jsdiff-console is now named assert-no-diff. Please update your package.json.
Last updated a year ago by kevingoslar .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jsdiff-console 
SYNC missed versions from official npm registry.

JsDiff with console output

Compares JS hashes using JsDiff and outputs the result on the console

CircleCI Coverage Status Dependency Status devDependency Status

This is a very simple helper method for printing the differences between two JSON or string variables to the console, for example in unit tests. It wraps the excellent diff module.

jsdiff = require("jsdiff-console")

// compare objects
jsdiff.json(actualJson, expectedJson)

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

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

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

If the two given values are different, the jsdiff methods throw an error with a console-formatted message. This will cause your test runtime to fail the current unit test and print a nicely readable diff of your objects.

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

Development

  • run all tests: make test
  • update dependencies: make update
  • see all available make commands: make help
  • deploy a new version:
    • commit an update with new version in package.json on master
    • run npm publish

Current Tags

  • 3.0.1                                ...           latest (a year ago)

18 Versions

  • 3.0.1 [deprecated]           ...           a year ago
  • 3.0.0 [deprecated]           ...           a year ago
  • 2.2.1 [deprecated]           ...           4 years ago
  • 2.2.0 [deprecated]           ...           4 years ago
  • 2.1.0 [deprecated]           ...           4 years ago
  • 2.0.0 [deprecated]           ...           4 years ago
  • 1.4.2 [deprecated]           ...           4 years ago
  • 1.4.1 [deprecated]           ...           4 years ago
  • 1.4.0 [deprecated]           ...           4 years ago
  • 1.3.0 [deprecated]           ...           5 years ago
  • 1.2.1 [deprecated]           ...           5 years ago
  • 1.2.0 [deprecated]           ...           5 years ago
  • 1.1.3 [deprecated]           ...           5 years ago
  • 1.1.2 [deprecated]           ...           5 years ago
  • 1.1.1 [deprecated]           ...           5 years ago
  • 1.1.0 [deprecated]           ...           5 years ago
  • 1.0.1 [deprecated]           ...           5 years ago
  • 1.0.0 [deprecated]           ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (11)

Copyright 2014 - 2017 © taobao.org |