Comparing version 2.1.0 to 3.0.0
@@ -1,12 +0,10 @@ | ||
'use strict' | ||
import { parseFragment } from 'parse5' | ||
import deepDiff from 'deep-diff' | ||
const parse5 = require('parse5') | ||
const deepDiff = require('deep-diff') | ||
import walk from './walk.js' | ||
import format from './format.js' | ||
import strategy from './strategy.js' | ||
import normalize from './normalize.js' | ||
const walk = require('./walk') | ||
const format = require('./format') | ||
const strategy = require('./strategy') | ||
const normalize = require('./normalize') | ||
function chaiHtmlPlugin(chai, utils) { | ||
export default function chaiHtmlPlugin(chai, utils) { | ||
chai.Assertion.addProperty('html', function () { | ||
@@ -27,4 +25,4 @@ new chai.Assertion(this._obj).to.be.a('string') | ||
const lhsTree = parse5.parseFragment(lhsFormatted) | ||
const rhsTree = parse5.parseFragment(rhsFormatted) | ||
const lhsTree = parseFragment(lhsFormatted) | ||
const rhsTree = parseFragment(rhsFormatted) | ||
@@ -70,3 +68,1 @@ const options = { | ||
} | ||
module.exports = chaiHtmlPlugin |
@@ -1,4 +0,2 @@ | ||
'use strict' | ||
module.exports = function format(html) { | ||
export default function format(html) { | ||
return ( | ||
@@ -5,0 +3,0 @@ html |
@@ -1,3 +0,1 @@ | ||
'use strict' | ||
function attributes(attrs) { | ||
@@ -70,3 +68,3 @@ return attrs | ||
module.exports = function normalize(tree, options) { | ||
export default function normalize(tree, options) { | ||
if (Array.isArray(tree)) { | ||
@@ -73,0 +71,0 @@ tree.forEach((x) => normalize(x, options)) |
@@ -1,3 +0,1 @@ | ||
'use strict' | ||
function thing(ast) { | ||
@@ -17,3 +15,3 @@ if (ast.nodeName === '#text') { | ||
module.exports = function strategy(diff, lhs, rhs) { | ||
export default function strategy(diff, lhs, rhs) { | ||
switch (diff.kind) { | ||
@@ -20,0 +18,0 @@ case 'N': |
@@ -1,4 +0,2 @@ | ||
'use strict' | ||
module.exports = function walk(tree, path) { | ||
export default function walk(tree, path) { | ||
let leaf = tree | ||
@@ -5,0 +3,0 @@ |
{ | ||
"name": "chai-html", | ||
"version": "2.1.0", | ||
"version": "3.0.0", | ||
"description": "HTML assertions for Chai.", | ||
@@ -12,11 +12,9 @@ "keywords": [ | ||
], | ||
"engines": { | ||
"node": ">= 12.0.0" | ||
}, | ||
"main": "lib/chai-html.js", | ||
"type": "module", | ||
"exports": "./lib/chai-html.js", | ||
"scripts": { | ||
"test": "npm run verify && npm run spec", | ||
"spec": "mocha 'tests/spec/*.js'", | ||
"lint": "eslint .", | ||
"format": "prettier --write '**/*.{ts,tsx,js,jsx,json,yml}'", | ||
"spec": "node --test --test-reporter spec", | ||
"lint": "eslint . --ext js", | ||
"format": "prettier --write '**/*.{js,jsx,json,yml}'", | ||
"verify": "npm run lint && npm run format", | ||
@@ -37,11 +35,16 @@ "prepublishOnly": "npm run test" | ||
"dependencies": { | ||
"deep-diff": "^1.0.0", | ||
"parse5": "^7.0.0" | ||
"deep-diff": "^1.0.2", | ||
"parse5": "^7.1.2" | ||
}, | ||
"devDependencies": { | ||
"chai": "^4.3.4", | ||
"eslint": "^8.17.0", | ||
"mocha": "^10.0.0", | ||
"prettier": "^2.6.2" | ||
"chai": "^5.0.2", | ||
"eslint": "^8.56.0", | ||
"prettier": "^3.2.4" | ||
}, | ||
"peerDependencies": { | ||
"chai": "^5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">= 18.0.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# Chai HTML | ||
# chai-html | ||
@@ -9,13 +9,13 @@ [](https://github.com/i-like-robots/chai-html/blob/main/LICENSE)  [](https://www.npmjs.com/package/chai-html) | ||
This is a [Node.js] module available through the [npm] registry. Before installing, download and install Node.js. Node.js 12 or higher is required. | ||
This is a [Node.js] module available through the [npm] registry. Node.js 18 or higher is required. | ||
Installation is done using the [npm install] command: | ||
```sh | ||
npm install -D chai-html | ||
$ npm install --save-dev chai-html | ||
``` | ||
👋 _Please note_ this package is for Chai v5 and is [ESM](https://nodejs.org/api/esm.html) only. For Chai v4 and CommonJS support use [version 2][v2] of this package. | ||
[Node.js]: https://nodejs.org/en/ | ||
[npm]: https://www.npmjs.com/ | ||
[npm install]: https://docs.npmjs.com/getting-started/installing-npm-packages-locally | ||
[v2]: https://github.com/i-like-robots/chai-html/tree/v2 | ||
@@ -25,4 +25,4 @@ ## Usage | ||
```js | ||
const { use, expect } = require('chai') | ||
const chaiHtml = require('chai-html') | ||
import { use, expect } from 'chai' | ||
import chaiHtml from 'chai-html' | ||
@@ -64,6 +64,6 @@ // Register the plugin | ||
This plugin is heavily inspired by the similar [chai-xml](https://www.npmjs.com/package/chai-xml) plugin. | ||
This plugin is inspired by the similar [chai-xml](https://www.npmjs.com/package/chai-xml) plugin. | ||
## License | ||
chai-html is MIT licensed. | ||
This package is MIT licensed. |
11480
3
10
186
Yes
3
+ Addedassertion-error@2.0.1(transitive)
+ Addedchai@5.2.0(transitive)
+ Addedcheck-error@2.1.1(transitive)
+ Addeddeep-eql@5.0.2(transitive)
+ Addedloupe@3.1.3(transitive)
+ Addedpathval@2.0.0(transitive)
Updateddeep-diff@^1.0.2
Updatedparse5@^7.1.2