html-validate 5.3.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/dist/cjs/browser.js +2 -6
- package/dist/cjs/browser.js.map +1 -1
- package/dist/cjs/cli.js +53 -28
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/core.d.ts +21 -7
- package/dist/cjs/core.js +618 -351
- package/dist/cjs/core.js.map +1 -1
- package/dist/cjs/html-validate.js +9 -9
- package/dist/cjs/html-validate.js.map +1 -1
- package/dist/cjs/index.d.ts +15 -2
- package/dist/cjs/index.js +2 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{matchers.d.ts → jest-lib.d.ts} +2 -4
- package/dist/cjs/{matchers.js → jest-lib.js} +125 -87
- package/dist/cjs/jest-lib.js.map +1 -0
- package/dist/cjs/jest.d.ts +4 -0
- package/dist/cjs/jest.js +17 -0
- package/dist/cjs/jest.js.map +1 -0
- package/dist/cjs/test-utils.js +1 -1
- package/dist/es/cli.js +34 -9
- package/dist/es/cli.js.map +1 -1
- package/dist/es/core.d.ts +21 -7
- package/dist/es/core.js +582 -315
- package/dist/es/core.js.map +1 -1
- package/dist/es/html-validate.js +1 -1
- package/dist/es/html-validate.js.map +1 -1
- package/dist/es/index.d.ts +15 -2
- package/dist/es/{matchers.d.ts → jest-lib.d.ts} +2 -4
- package/dist/es/{matchers.js → jest-lib.js} +120 -82
- package/dist/es/jest-lib.js.map +1 -0
- package/dist/es/jest.d.ts +4 -0
- package/dist/es/jest.js +16 -0
- package/dist/es/jest.js.map +1 -0
- package/dist/schema/elements.json +43 -5
- package/elements/html5.json +940 -290
- package/jest.d.ts +1 -1
- package/jest.js +1 -1
- package/package.json +30 -28
- package/dist/cjs/matchers.js.map +0 -1
- package/dist/es/matchers.js.map +0 -1
|
@@ -61,7 +61,7 @@ function lint(files) {
|
|
|
61
61
|
return htmlvalidate.validateFile(filename);
|
|
62
62
|
}
|
|
63
63
|
catch (err) {
|
|
64
|
-
console.error(kleur__default[
|
|
64
|
+
console.error(kleur__default["default"].red(`Validator crashed when parsing "${filename}"`));
|
|
65
65
|
throw err;
|
|
66
66
|
}
|
|
67
67
|
});
|
|
@@ -99,11 +99,11 @@ function renameStdin(report, filename) {
|
|
|
99
99
|
}
|
|
100
100
|
function handleValidationError(err) {
|
|
101
101
|
if (err.filename) {
|
|
102
|
-
const filename = path__default[
|
|
103
|
-
console.log(kleur__default[
|
|
102
|
+
const filename = path__default["default"].relative(process.cwd(), err.filename);
|
|
103
|
+
console.log(kleur__default["default"].red(`A configuration error was found in "${filename}":`));
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
console.log(kleur__default[
|
|
106
|
+
console.log(kleur__default["default"].red(`A configuration error was found:`));
|
|
107
107
|
}
|
|
108
108
|
console.group();
|
|
109
109
|
{
|
|
@@ -112,7 +112,7 @@ function handleValidationError(err) {
|
|
|
112
112
|
console.groupEnd();
|
|
113
113
|
}
|
|
114
114
|
function handleUserError(err) {
|
|
115
|
-
console.error(kleur__default[
|
|
115
|
+
console.error(kleur__default["default"].red("Caught exception:"));
|
|
116
116
|
console.group();
|
|
117
117
|
{
|
|
118
118
|
console.error(err);
|
|
@@ -120,21 +120,21 @@ function handleUserError(err) {
|
|
|
120
120
|
console.groupEnd();
|
|
121
121
|
}
|
|
122
122
|
function handleUnknownError(err) {
|
|
123
|
-
console.error(kleur__default[
|
|
123
|
+
console.error(kleur__default["default"].red("Caught exception:"));
|
|
124
124
|
console.group();
|
|
125
125
|
{
|
|
126
126
|
console.error(err);
|
|
127
127
|
}
|
|
128
128
|
console.groupEnd();
|
|
129
129
|
const bugUrl = `${core.bugs.url}?issuable_template=Bug`;
|
|
130
|
-
console.error(kleur__default[
|
|
131
|
-
console.error(kleur__default[
|
|
130
|
+
console.error(kleur__default["default"].red(`This is a bug in ${core.name}-${core.version}.`));
|
|
131
|
+
console.error(kleur__default["default"].red([
|
|
132
132
|
`Please file a bug at ${bugUrl}`,
|
|
133
133
|
`and include this message in full and if possible the content of the`,
|
|
134
134
|
`file being parsed (or a reduced testcase).`,
|
|
135
135
|
].join("\n")));
|
|
136
136
|
}
|
|
137
|
-
const argv = minimist__default[
|
|
137
|
+
const argv = minimist__default["default"](process.argv.slice(2), {
|
|
138
138
|
string: ["c", "config", "ext", "f", "formatter", "max-warnings", "rule", "stdin-filename"],
|
|
139
139
|
boolean: [
|
|
140
140
|
"init",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-validate.js","sources":["../../../src/cli/html-validate.ts"],"sourcesContent":[null],"names":["kleur","Reporter","eventFormatter","path","pkgBugs","name","version","minimist","CLI","SchemaValidationError","UserError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AASA,IAAK,IAQJ;AARD,WAAK,IAAI;IACR,+BAAI,CAAA;IACJ,+BAAI,CAAA;IACJ,6CAAW,CAAA;IACX,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,6CAAW,CAAA;IACX,+CAAY,CAAA;AACb,CAAC,EARI,IAAI,KAAJ,IAAI,QAQR;AAED,SAAS,OAAO,CAAC,IAA4B;IAC5C,IAAI,IAAI,CAAC,IAAI,EAAE;QACd,OAAO,IAAI,CAAC,IAAI,CAAC;KACjB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;KACtB;IAED,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE;QACzB,OAAO,IAAI,CAAC,YAAY,CAAC;KACzB;IAED,O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eAAe,CAAC,GAAc;IACtC,OAAO,CAAC,KAAK,CAACA,yBAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,EAAE,CAAC;IAChB;QACC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACnB;IACD,OAAO,CAAC,QAAQ,EAAE,CAAC;AACpB,CAAC;AAED,SAAS,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"html-validate.js","sources":["../../../src/cli/html-validate.ts"],"sourcesContent":[null],"names":["kleur","Reporter","eventFormatter","path","pkgBugs","name","version","minimist","CLI","SchemaValidationError","UserError"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AASA,IAAK,IAQJ;AARD,WAAK,IAAI;IACR,+BAAI,CAAA;IACJ,+BAAI,CAAA;IACJ,6CAAW,CAAA;IACX,6CAAW,CAAA;IACX,yCAAS,CAAA;IACT,6CAAW,CAAA;IACX,+CAAY,CAAA;AACb,CAAC,EARI,IAAI,KAAJ,IAAI,QAQR;AAED,SAAS,OAAO,CAAC,IAA4B;IAC5C,IAAI,IAAI,CAAC,IAAI,EAAE;QACd,OAAO,IAAI,CAAC,IAAI,CAAC;KACjB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,aAAa,CAAC,EAAE;QACxB,OAAO,IAAI,CAAC,WAAW,CAAC;KACxB;IAED,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC;KACtB;IAED,IAAI,IAAI,CAAC,cAAc,CAAC,EAAE;QACzB,OAAO,IAAI,CAAC,YAAY,CAAC;KACzB;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AAClB,CAAC;AAED,SA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KAC3B;SAAM,IAAI,GAAG,YAAYC,cAAS,EAAE;QACpC,eAAe,CAAC,GAAG,CAAC,CAAC;KACrB;SAAM;QACN,kBAAkB,CAAC,GAAG,CAAC,CAAC;KACxB;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;;"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { m as Report, H as HtmlValidate, a as ConfigData } from './core';
|
|
1
|
+
import { m as Report, c as ConfigLoader, H as HtmlValidate, a as ConfigData } from './core';
|
|
2
2
|
export { A as AttributeData, W as AttributeEvent, a7 as CompatibilityOptions, Y as ConditionalEvent, C as Config, a as ConfigData, b as ConfigError, c as ConfigLoader, B as ConfigReadyEvent, $ as DOMLoadEvent, a0 as DOMReadyEvent, Z as DirectiveEvent, _ as DoctypeEvent, D as DynamicValue, V as ElementReadyEvent, z as Event, y as EventCallback, E as EventDump, x as EventHandler, a3 as FileSystemConfigLoader, a4 as Formatter, e as HtmlElement, H as HtmlValidate, a2 as ListenEventMap, L as Location, o as Message, j as MetaCopyableProperty, M as MetaData, h as MetaElement, i as MetaTable, N as NodeClosed, v as Parser, u as Plugin, P as ProcessElementContext, m as Report, n as Reporter, q as Result, R as Rule, k as RuleDocumentation, g as SchemaValidationError, S as Severity, l as Source, F as SourceReadyEvent, d as StaticConfigLoader, O as TagCloseEvent, K as TagEndEvent, J as TagOpenEvent, Q as TagReadyEvent, I as TagStartEvent, t as TemplateExtractor, T as TextNode, f as TokenDump, G as TokenEvent, r as TransformContext, s as Transformer, a1 as TriggerEventMap, U as UserError, X as WhitespaceEvent, a6 as compatibilityCheck, p as configPresets, a5 as formatterFactory, w as ruleExists } from './core';
|
|
3
3
|
import 'ajv';
|
|
4
4
|
import 'ajv/dist/types';
|
|
@@ -28,6 +28,7 @@ interface CLIOptions {
|
|
|
28
28
|
declare class CLI {
|
|
29
29
|
private options;
|
|
30
30
|
private config;
|
|
31
|
+
private loader;
|
|
31
32
|
private ignored;
|
|
32
33
|
/**
|
|
33
34
|
* Create new CLI helper.
|
|
@@ -37,7 +38,10 @@ declare class CLI {
|
|
|
37
38
|
*/
|
|
38
39
|
constructor(options?: CLIOptions);
|
|
39
40
|
/**
|
|
40
|
-
* Returns list of files matching patterns and are not ignored.
|
|
41
|
+
* Returns list of files matching patterns and are not ignored. Filenames will
|
|
42
|
+
* have absolute paths.
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
41
45
|
*/
|
|
42
46
|
expandFiles(patterns: string[], options?: ExpandOptions): string[];
|
|
43
47
|
getFormatter(formatters: string): (report: Report) => string;
|
|
@@ -63,6 +67,15 @@ declare class CLI {
|
|
|
63
67
|
/**
|
|
64
68
|
* Get HtmlValidate instance with configuration based on options passed to the
|
|
65
69
|
* constructor.
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
getLoader(): ConfigLoader;
|
|
74
|
+
/**
|
|
75
|
+
* Get HtmlValidate instance with configuration based on options passed to the
|
|
76
|
+
* constructor.
|
|
77
|
+
*
|
|
78
|
+
* @public
|
|
66
79
|
*/
|
|
67
80
|
getValidator(): HtmlValidate;
|
|
68
81
|
/**
|
package/dist/cjs/index.js
CHANGED
|
@@ -32,9 +32,7 @@ exports.MetaCopyableProperty = core.MetaCopyableProperty;
|
|
|
32
32
|
exports.MetaTable = core.MetaTable;
|
|
33
33
|
Object.defineProperty(exports, 'NodeClosed', {
|
|
34
34
|
enumerable: true,
|
|
35
|
-
get: function () {
|
|
36
|
-
return core.NodeClosed;
|
|
37
|
-
}
|
|
35
|
+
get: function () { return core.NodeClosed; }
|
|
38
36
|
});
|
|
39
37
|
exports.Parser = core.Parser;
|
|
40
38
|
exports.Reporter = core.Reporter;
|
|
@@ -42,9 +40,7 @@ exports.Rule = core.Rule;
|
|
|
42
40
|
exports.SchemaValidationError = core.SchemaValidationError;
|
|
43
41
|
Object.defineProperty(exports, 'Severity', {
|
|
44
42
|
enumerable: true,
|
|
45
|
-
get: function () {
|
|
46
|
-
return core.Severity;
|
|
47
|
-
}
|
|
43
|
+
get: function () { return core.Severity; }
|
|
48
44
|
});
|
|
49
45
|
exports.StaticConfigLoader = core.StaticConfigLoader;
|
|
50
46
|
exports.TemplateExtractor = core.TemplateExtractor;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { a as ConfigData, o as Message, a8 as TokenType } from './core';
|
|
2
|
-
import 'ajv';
|
|
3
|
-
import 'ajv/dist/types';
|
|
1
|
+
import { a as ConfigData, o as Message, a8 as TokenType, L as Location } from './core';
|
|
4
2
|
|
|
5
3
|
interface TokenMatcher {
|
|
6
4
|
type: TokenType;
|
|
7
|
-
location?:
|
|
5
|
+
location?: Partial<Location>;
|
|
8
6
|
data?: any;
|
|
9
7
|
}
|
|
10
8
|
declare global {
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var jestDiffDefault = require('jest-diff');
|
|
4
|
-
var deepmerge = require('deepmerge');
|
|
5
4
|
var core = require('./core.js');
|
|
6
|
-
require('
|
|
7
|
-
require('@sidvind/better-ajv-errors');
|
|
8
|
-
require('ajv');
|
|
9
|
-
require('json-merge-patch');
|
|
10
|
-
require('path');
|
|
11
|
-
require('semver');
|
|
12
|
-
require('kleur');
|
|
13
|
-
require('@babel/code-frame');
|
|
14
|
-
require('@html-validate/stylish');
|
|
5
|
+
var deepmerge = require('deepmerge');
|
|
15
6
|
|
|
16
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
8
|
|
|
@@ -24,14 +15,12 @@ function _interopNamespace(e) {
|
|
|
24
15
|
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
25
16
|
Object.defineProperty(n, k, d.get ? d : {
|
|
26
17
|
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return e[k];
|
|
29
|
-
}
|
|
18
|
+
get: function () { return e[k]; }
|
|
30
19
|
});
|
|
31
20
|
}
|
|
32
21
|
});
|
|
33
22
|
}
|
|
34
|
-
n[
|
|
23
|
+
n["default"] = e;
|
|
35
24
|
return Object.freeze(n);
|
|
36
25
|
}
|
|
37
26
|
|
|
@@ -39,13 +28,13 @@ var jestDiffDefault__default = /*#__PURE__*/_interopDefaultLegacy(jestDiffDefaul
|
|
|
39
28
|
var jestDiffDefault__namespace = /*#__PURE__*/_interopNamespace(jestDiffDefault);
|
|
40
29
|
var deepmerge__default = /*#__PURE__*/_interopDefaultLegacy(deepmerge);
|
|
41
30
|
|
|
42
|
-
/* eslint-disable @typescript-eslint/
|
|
31
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
43
32
|
/* ignore typing for compatibility so it will seem "impossible" but different version will yield different source */
|
|
44
33
|
const diffCandidates = [
|
|
45
34
|
// @ts-ignore
|
|
46
|
-
jestDiffDefault__default[
|
|
35
|
+
jestDiffDefault__default["default"] === null || jestDiffDefault__default["default"] === void 0 ? void 0 : jestDiffDefault__default["default"].diff,
|
|
47
36
|
// @ts-ignore
|
|
48
|
-
jestDiffDefault__default[
|
|
37
|
+
jestDiffDefault__default["default"],
|
|
49
38
|
// @ts-ignore
|
|
50
39
|
jestDiffDefault__namespace === null || jestDiffDefault__namespace === void 0 ? void 0 : jestDiffDefault__namespace.diff,
|
|
51
40
|
// @ts-ignore
|
|
@@ -55,6 +44,33 @@ const isFunction = (fn) => typeof fn === "function";
|
|
|
55
44
|
/* istanbul ignore next: covered by compatibility tests but not a single pass */
|
|
56
45
|
/* @ts-ignore assume one of the candidate matches, there will be a reasonable error later on if not */
|
|
57
46
|
const diff = diffCandidates.find(isFunction);
|
|
47
|
+
|
|
48
|
+
function isThenable(src) {
|
|
49
|
+
return src && typeof src === "object" && typeof src.then === "function";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Creates a wrapped function based on the passed function.
|
|
54
|
+
*
|
|
55
|
+
* The returned function takes either a `T` or `Promise<T>`. If `T` the result
|
|
56
|
+
* will be synchronous or if `Promise<T>` the result will be asynchronous.
|
|
57
|
+
*
|
|
58
|
+
* In practice this means that if you pass a synchronous object into it you will
|
|
59
|
+
* maintain synchronous code but if you pass an asynchronous object you must
|
|
60
|
+
* await the result.
|
|
61
|
+
*/
|
|
62
|
+
function diverge(fn) {
|
|
63
|
+
function diverged(actual, ...args) {
|
|
64
|
+
if (isThenable(actual)) {
|
|
65
|
+
return actual.then((resolved) => fn.call(this, resolved, ...args));
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return fn.call(this, actual, ...args);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return diverged;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
/**
|
|
59
75
|
* Takes all messages from all files and flattens to a single array.
|
|
60
76
|
*/
|
|
@@ -63,8 +79,8 @@ function flattenMessages(report) {
|
|
|
63
79
|
return aggregated.concat(result.messages);
|
|
64
80
|
}, []);
|
|
65
81
|
}
|
|
66
|
-
|
|
67
|
-
|
|
82
|
+
|
|
83
|
+
function toBeValid(report) {
|
|
68
84
|
if (report.valid) {
|
|
69
85
|
return {
|
|
70
86
|
pass: true,
|
|
@@ -79,8 +95,9 @@ async function toBeValid(actual) {
|
|
|
79
95
|
};
|
|
80
96
|
}
|
|
81
97
|
}
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
var toBeValid$1 = diverge(toBeValid);
|
|
99
|
+
|
|
100
|
+
function toBeInvalid(report) {
|
|
84
101
|
if (report.valid) {
|
|
85
102
|
return {
|
|
86
103
|
pass: false,
|
|
@@ -94,48 +111,34 @@ async function toBeInvalid(actual) {
|
|
|
94
111
|
};
|
|
95
112
|
}
|
|
96
113
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
114
|
+
var toBeInvalid$1 = diverge(toBeInvalid);
|
|
115
|
+
|
|
116
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types, prefer-template */
|
|
117
|
+
function toBeToken(actual, expected) {
|
|
118
|
+
const token = actual.value;
|
|
119
|
+
// istanbul ignore next: TokenMatcher requires "type" property to be set, this is just a failsafe
|
|
120
|
+
if (token.type) {
|
|
121
|
+
token.type = core.TokenType[token.type];
|
|
103
122
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
` ${this.utils.printReceived(flattened)}` +
|
|
113
|
-
/* istanbul ignore next */ (diffString ? `\n\nDifference:\n\n${diffString}` : "");
|
|
114
|
-
return { pass, message: resultMessage };
|
|
115
|
-
}
|
|
116
|
-
async function toHaveErrors(actual, errors) {
|
|
117
|
-
const report = await actual;
|
|
118
|
-
const flattened = flattenMessages(report);
|
|
119
|
-
const matcher = errors.map((entry) => {
|
|
120
|
-
if (Array.isArray(entry)) {
|
|
121
|
-
const [ruleId, message] = entry;
|
|
122
|
-
return expect.objectContaining({ ruleId, message });
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
return expect.objectContaining(entry);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const pass = this.equals(flattened, matcher);
|
|
129
|
-
const diffString = diff(matcher, flattened, { expand: this.expand });
|
|
130
|
-
const resultMessage = () => this.utils.matcherHint(".toHaveErrors") +
|
|
123
|
+
// istanbul ignore next: TokenMatcher requires "type" property to be set, this is just a failsafe
|
|
124
|
+
if (expected.type) {
|
|
125
|
+
expected.type = core.TokenType[expected.type];
|
|
126
|
+
}
|
|
127
|
+
const matcher = expect.objectContaining(expected);
|
|
128
|
+
const pass = this.equals(token, matcher);
|
|
129
|
+
const diffString = diff(matcher, token, { expand: this.expand });
|
|
130
|
+
const message = () => this.utils.matcherHint(".toBeToken") +
|
|
131
131
|
"\n\n" +
|
|
132
|
-
"Expected
|
|
132
|
+
"Expected token to equal:\n" +
|
|
133
133
|
` ${this.utils.printExpected(matcher)}\n` +
|
|
134
134
|
"Received:\n" +
|
|
135
|
-
` ${this.utils.printReceived(
|
|
135
|
+
` ${this.utils.printReceived(token)}` +
|
|
136
136
|
/* istanbul ignore next */ (diffString ? `\n\nDifference:\n\n${diffString}` : "");
|
|
137
|
-
return { pass, message
|
|
137
|
+
return { pass, message };
|
|
138
138
|
}
|
|
139
|
+
var toBeToken$1 = diverge(toBeToken);
|
|
140
|
+
|
|
141
|
+
/* eslint-disable @typescript-eslint/ban-ts-comment, prefer-template */
|
|
139
142
|
function isMessage(arg) {
|
|
140
143
|
return (arg &&
|
|
141
144
|
(arg.ruleId ||
|
|
@@ -154,17 +157,25 @@ function isConfig(arg) {
|
|
|
154
157
|
function isString(arg) {
|
|
155
158
|
return typeof arg === "string";
|
|
156
159
|
}
|
|
157
|
-
function
|
|
158
|
-
// @ts-ignore DOM library not available
|
|
159
|
-
actual, arg0, arg1, arg2) {
|
|
160
|
+
function getMarkup(src) {
|
|
160
161
|
// @ts-ignore DOM library not available
|
|
161
|
-
if (typeof HTMLElement !== "undefined" &&
|
|
162
|
-
|
|
162
|
+
if (typeof HTMLElement !== "undefined" && src instanceof HTMLElement) {
|
|
163
|
+
return src.outerHTML;
|
|
164
|
+
}
|
|
165
|
+
/* istanbul ignore else: prototype only allows string or HTMLElement */
|
|
166
|
+
if (typeof src === "string") {
|
|
167
|
+
return src;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
throw new Error(`Failed to get markup from "${typeof src}" argument`);
|
|
163
171
|
}
|
|
172
|
+
}
|
|
173
|
+
function toHTMLValidate(actual, arg0, arg1, arg2) {
|
|
174
|
+
const markup = getMarkup(actual);
|
|
164
175
|
const message = isMessage(arg0) ? arg0 : undefined;
|
|
165
176
|
const config = isConfig(arg0) ? arg0 : isConfig(arg1) ? arg1 : undefined;
|
|
166
177
|
const filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2;
|
|
167
|
-
return toHTMLValidateImpl.call(this,
|
|
178
|
+
return toHTMLValidateImpl.call(this, markup, message, config, filename);
|
|
168
179
|
}
|
|
169
180
|
function toHTMLValidateImpl(actual, expectedError, userConfig, filename) {
|
|
170
181
|
const defaultConfig = {
|
|
@@ -174,7 +185,7 @@ function toHTMLValidateImpl(actual, expectedError, userConfig, filename) {
|
|
|
174
185
|
"void-style": "off",
|
|
175
186
|
},
|
|
176
187
|
};
|
|
177
|
-
const config = deepmerge__default[
|
|
188
|
+
const config = deepmerge__default["default"](defaultConfig, userConfig || {});
|
|
178
189
|
const actualFilename = filename || this.testPath;
|
|
179
190
|
const htmlvalidate = new core.HtmlValidate();
|
|
180
191
|
const report = htmlvalidate.validateString(actual, actualFilename, config);
|
|
@@ -210,34 +221,61 @@ function toHTMLValidateImpl(actual, expectedError, userConfig, filename) {
|
|
|
210
221
|
};
|
|
211
222
|
}
|
|
212
223
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
if (
|
|
221
|
-
expected.
|
|
224
|
+
var toHTMLValidate$1 = diverge(toHTMLValidate);
|
|
225
|
+
|
|
226
|
+
/* eslint-disable prefer-template */
|
|
227
|
+
function toHaveError(actual, ruleId, message, context // eslint-disable-line @typescript-eslint/explicit-module-boundary-types
|
|
228
|
+
) {
|
|
229
|
+
const flattened = flattenMessages(actual);
|
|
230
|
+
const expected = { ruleId, message };
|
|
231
|
+
if (context) {
|
|
232
|
+
expected.context = context;
|
|
222
233
|
}
|
|
223
|
-
const matcher = expect.objectContaining(expected);
|
|
224
|
-
const pass = this.equals(
|
|
225
|
-
const diffString = diff(matcher,
|
|
226
|
-
const
|
|
234
|
+
const matcher = [expect.objectContaining(expected)];
|
|
235
|
+
const pass = this.equals(flattened, matcher);
|
|
236
|
+
const diffString = diff(matcher, flattened, { expand: this.expand });
|
|
237
|
+
const resultMessage = () => this.utils.matcherHint(".toHaveError") +
|
|
227
238
|
"\n\n" +
|
|
228
|
-
"Expected
|
|
239
|
+
"Expected error to equal:\n" +
|
|
229
240
|
` ${this.utils.printExpected(matcher)}\n` +
|
|
230
241
|
"Received:\n" +
|
|
231
|
-
` ${this.utils.printReceived(
|
|
242
|
+
` ${this.utils.printReceived(flattened)}` +
|
|
232
243
|
/* istanbul ignore next */ (diffString ? `\n\nDifference:\n\n${diffString}` : "");
|
|
233
|
-
return { pass, message };
|
|
244
|
+
return { pass, message: resultMessage };
|
|
234
245
|
}
|
|
246
|
+
var toHaveError$1 = diverge(toHaveError);
|
|
247
|
+
|
|
248
|
+
/* eslint-disable prefer-template */
|
|
249
|
+
function toHaveErrors(report, errors) {
|
|
250
|
+
const flattened = flattenMessages(report);
|
|
251
|
+
const matcher = errors.map((entry) => {
|
|
252
|
+
if (Array.isArray(entry)) {
|
|
253
|
+
const [ruleId, message] = entry;
|
|
254
|
+
return expect.objectContaining({ ruleId, message });
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
return expect.objectContaining(entry);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
const pass = this.equals(flattened, matcher);
|
|
261
|
+
const diffString = diff(matcher, flattened, { expand: this.expand });
|
|
262
|
+
const resultMessage = () => this.utils.matcherHint(".toHaveErrors") +
|
|
263
|
+
"\n\n" +
|
|
264
|
+
"Expected error to equal:\n" +
|
|
265
|
+
` ${this.utils.printExpected(matcher)}\n` +
|
|
266
|
+
"Received:\n" +
|
|
267
|
+
` ${this.utils.printReceived(flattened)}` +
|
|
268
|
+
/* istanbul ignore next */ (diffString ? `\n\nDifference:\n\n${diffString}` : "");
|
|
269
|
+
return { pass, message: resultMessage };
|
|
270
|
+
}
|
|
271
|
+
var toHaveErrors$1 = diverge(toHaveErrors);
|
|
272
|
+
|
|
235
273
|
expect.extend({
|
|
236
|
-
toBeValid,
|
|
237
|
-
toBeInvalid,
|
|
238
|
-
toHaveError,
|
|
239
|
-
toHaveErrors,
|
|
240
|
-
|
|
241
|
-
|
|
274
|
+
toBeValid: toBeValid$1,
|
|
275
|
+
toBeInvalid: toBeInvalid$1,
|
|
276
|
+
toHaveError: toHaveError$1,
|
|
277
|
+
toHaveErrors: toHaveErrors$1,
|
|
278
|
+
toBeToken: toBeToken$1,
|
|
279
|
+
toHTMLValidate: toHTMLValidate$1,
|
|
242
280
|
});
|
|
243
|
-
//# sourceMappingURL=
|
|
281
|
+
//# sourceMappingURL=jest-lib.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest-lib.js","sources":["../../../src/jest/utils/diff.ts","../../../src/jest/utils/is-thenable.ts","../../../src/jest/utils/diverge.ts","../../../src/jest/utils/flatten-messages.ts","../../../src/jest/matchers/to-be-valid.ts","../../../src/jest/matchers/to-be-invalid.ts","../../../src/jest/matchers/to-be-token.ts","../../../src/jest/matchers/to-htmlvalidate.ts","../../../src/jest/matchers/to-have-error.ts","../../../src/jest/matchers/to-have-errors.ts","../../../src/jest/matchers/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null],"names":["jestDiffDefault","jestDiff","TokenType","deepmerge","HtmlValidate","toBeValid","toBeInvalid","toHaveError","toHaveErrors","toBeToken","toHTMLValidate"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAIA;AACA,MAAM,cAAc,GAAgC;;IAEnDA,mCAAe,aAAfA,mCAAe,uBAAfA,mCAAe,CAAE,IAAI;;IAErBA,mCAAe;;IAEfC,0BAAQ,aAARA,0BAAQ,uBAARA,0BAAQ,CAAE,IAAI;;IAEdA,0BAAQ;CACR,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,EAAW,KAAc,OAAO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C,SAAS,EAAE,OAAO,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACrE,MAAM,aAAa,GAAG,MACrB,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC;QACvC,MAAM;QACN,4BAA4B;QAC5B,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI;QAC1C,aAAa;QACb,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;oCACd,UAAU,GAAG,sBAAsB,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;IAEnF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;AACzC,CAAC;AAED,qBAAe,OAAO,CAAC,YAAY,CAAC;;ACgBpC,MAAM,CAAC,MAAM,CAAC;eACbC,WAAS;iBACTC,aAAW;iBACXC,aAAW;kBACXC,cAAY;eACZC,WAAS;oBACTC,gBAAc;CACd,CAAC;;"}
|
package/dist/cjs/jest.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('./jest-lib.js');
|
|
4
|
+
require('jest-diff');
|
|
5
|
+
require('./core.js');
|
|
6
|
+
require('fs');
|
|
7
|
+
require('@sidvind/better-ajv-errors');
|
|
8
|
+
require('ajv');
|
|
9
|
+
require('deepmerge');
|
|
10
|
+
require('json-merge-patch');
|
|
11
|
+
require('path');
|
|
12
|
+
require('semver');
|
|
13
|
+
require('kleur');
|
|
14
|
+
require('@babel/code-frame');
|
|
15
|
+
require('@html-validate/stylish');
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=jest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jest.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
package/dist/cjs/test-utils.js
CHANGED
|
@@ -16,7 +16,7 @@ var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
|
16
16
|
* @param chain - If set this function is called when chaining transformers. Default is pass-thru.
|
|
17
17
|
*/
|
|
18
18
|
function transformFile(fn, filename, chain) {
|
|
19
|
-
const data = fs__default[
|
|
19
|
+
const data = fs__default["default"].readFileSync(filename, "utf-8");
|
|
20
20
|
const source = {
|
|
21
21
|
filename,
|
|
22
22
|
line: 1,
|
package/dist/es/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as getFormatter$1, l as legacyRequire, U as UserError, H as HtmlValidate } from './core.js';
|
|
1
|
+
import { i as getFormatter$1, l as legacyRequire, U as UserError, F as FileSystemConfigLoader, H as HtmlValidate } from './core.js';
|
|
2
2
|
import fs, { readFileSync } from 'fs';
|
|
3
3
|
import 'semver';
|
|
4
4
|
import 'kleur';
|
|
@@ -18,6 +18,14 @@ function isDirectory(filename) {
|
|
|
18
18
|
const st = fs.statSync(filename);
|
|
19
19
|
return st.isDirectory();
|
|
20
20
|
}
|
|
21
|
+
function join(stem, filename) {
|
|
22
|
+
if (path.isAbsolute(filename)) {
|
|
23
|
+
return path.normalize(filename);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return path.normalize(path.join(stem, filename));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
21
29
|
function directoryPattern(extensions) {
|
|
22
30
|
switch (extensions.length) {
|
|
23
31
|
case 0:
|
|
@@ -43,13 +51,13 @@ function expandFiles(patterns, options) {
|
|
|
43
51
|
}
|
|
44
52
|
for (const filename of glob.sync(pattern, { cwd })) {
|
|
45
53
|
/* if file is a directory recursively expand files from it */
|
|
46
|
-
const fullpath =
|
|
54
|
+
const fullpath = join(cwd, filename);
|
|
47
55
|
if (isDirectory(fullpath)) {
|
|
48
|
-
const dir = expandFiles([directoryPattern(extensions)],
|
|
49
|
-
result = result.concat(dir.map((cur) =>
|
|
56
|
+
const dir = expandFiles([directoryPattern(extensions)], { ...options, cwd: fullpath });
|
|
57
|
+
result = result.concat(dir.map((cur) => join(filename, cur)));
|
|
50
58
|
continue;
|
|
51
59
|
}
|
|
52
|
-
result.push(
|
|
60
|
+
result.push(fullpath);
|
|
53
61
|
}
|
|
54
62
|
return result;
|
|
55
63
|
}, []);
|
|
@@ -248,10 +256,14 @@ class CLI {
|
|
|
248
256
|
constructor(options) {
|
|
249
257
|
this.options = options || {};
|
|
250
258
|
this.config = this.getConfig();
|
|
259
|
+
this.loader = new FileSystemConfigLoader(this.config);
|
|
251
260
|
this.ignored = new IsIgnored();
|
|
252
261
|
}
|
|
253
262
|
/**
|
|
254
|
-
* Returns list of files matching patterns and are not ignored.
|
|
263
|
+
* Returns list of files matching patterns and are not ignored. Filenames will
|
|
264
|
+
* have absolute paths.
|
|
265
|
+
*
|
|
266
|
+
* @public
|
|
255
267
|
*/
|
|
256
268
|
expandFiles(patterns, options = {}) {
|
|
257
269
|
return expandFiles(patterns, options).filter((filename) => !this.isIgnored(filename));
|
|
@@ -282,14 +294,27 @@ class CLI {
|
|
|
282
294
|
* or call [[HtmlValidate.flushConfigCache]].
|
|
283
295
|
*/
|
|
284
296
|
clearCache() {
|
|
297
|
+
this.loader.flushCache();
|
|
285
298
|
this.ignored.clearCache();
|
|
286
299
|
}
|
|
287
300
|
/**
|
|
288
301
|
* Get HtmlValidate instance with configuration based on options passed to the
|
|
289
302
|
* constructor.
|
|
303
|
+
*
|
|
304
|
+
* @internal
|
|
305
|
+
*/
|
|
306
|
+
getLoader() {
|
|
307
|
+
return this.loader;
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Get HtmlValidate instance with configuration based on options passed to the
|
|
311
|
+
* constructor.
|
|
312
|
+
*
|
|
313
|
+
* @public
|
|
290
314
|
*/
|
|
291
315
|
getValidator() {
|
|
292
|
-
|
|
316
|
+
const loader = this.getLoader();
|
|
317
|
+
return new HtmlValidate(loader);
|
|
293
318
|
}
|
|
294
319
|
/**
|
|
295
320
|
* @internal
|
|
@@ -313,9 +338,9 @@ class CLI {
|
|
|
313
338
|
config.extends = [];
|
|
314
339
|
config.rules = rules;
|
|
315
340
|
}
|
|
316
|
-
catch (
|
|
341
|
+
catch (err) {
|
|
317
342
|
// istanbul ignore next
|
|
318
|
-
throw new UserError(`Error while parsing --rule option "{${raw}}": ${
|
|
343
|
+
throw new UserError(`Error while parsing --rule option "{${raw}}": ${err.message}.\n`);
|
|
319
344
|
}
|
|
320
345
|
}
|
|
321
346
|
return config;
|