
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
assert-html
Advanced tools
Assert two HTML strings are equal. Similar to spok but for HTML. Use assert-snapshot if you want an automated workflow.
var assertHtml = require('assert-html')
var tape = require('tape')
var html = require('bel')
tape('compare two DOM strings', function (assert) {
var a, b
a = html`<section>hello planet</section>`.toString()
b = html`<section>hello world</section>`.toString()
assertHtml(assert, a, b)
a = html`<div><b>hello</b> planet</div>`.toString()
b = html`<div><b>hello</b> planet</div>`.toString()
assertHtml(assert, a, b)
assert.end()
})
Outputs:
TAP version 13
# compare two DOM strings
ok 1 <section>
not ok 2 ยทยท hello world
---
operator: equal
expected: 'ยทยท hello world'
actual: 'ยทยท hello planet'
at: assertHtml (/Users/anon/src/shama/assert-html/index.js:59:13)
...
ok 3 </section>
ok 4 <div>
ok 5 ยทยท <b>
ok 6 ยทยท ยทยท hello
ok 7 ยทยท </b>
ok 8 ยทยท planet
ok 9 </div>
1..9
# tests 9
# pass 8
# fail 1
assertHtml(assert, actual, expected)
Assert two DOM strings are equal using a custom assert function. Calls
assert.equal()
method from the assert function.
FAQs
Assert two HTML strings are equal
The npm package assert-html receives a total of 60 weekly downloads. As such, assert-html popularity was classified as not popular.
We found that assert-html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.ย It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600ร faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.