jest-preset-stylelint 5.0.3 → 5.0.4
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/getTestRule.js +21 -24
- package/package.json +9 -9
package/getTestRule.js
CHANGED
|
@@ -63,33 +63,30 @@ module.exports = function getTestRule(options = {}) {
|
|
|
63
63
|
|
|
64
64
|
const actualWarnings = outputAfterLint.results[0].warnings;
|
|
65
65
|
|
|
66
|
-
expect(outputAfterLint.results[0]
|
|
66
|
+
expect(outputAfterLint.results[0]).toMatchObject({ parseErrors: [] });
|
|
67
67
|
expect(actualWarnings).toHaveLength(testCase.warnings ? testCase.warnings.length : 1);
|
|
68
68
|
|
|
69
|
-
(testCase.warnings || [testCase]).
|
|
70
|
-
const warning = actualWarnings[i];
|
|
71
|
-
|
|
69
|
+
for (const [i, expected] of (testCase.warnings || [testCase]).entries()) {
|
|
72
70
|
// @ts-expect-error -- This is our custom matcher.
|
|
73
71
|
expect(expected).toHaveMessage();
|
|
74
72
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
73
|
+
const expectedWarning = {
|
|
74
|
+
text: expected.message,
|
|
75
|
+
line: expected.line,
|
|
76
|
+
column: expected.column,
|
|
77
|
+
endLine: expected.endLine,
|
|
78
|
+
endColumn: expected.endColumn,
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
for (const [key, value] of Object.entries(expectedWarning)) {
|
|
82
|
+
if (value === undefined) {
|
|
83
|
+
// @ts-expect-error -- Allow a partial object.
|
|
84
|
+
delete expectedWarning[key];
|
|
85
|
+
}
|
|
87
86
|
}
|
|
88
87
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
});
|
|
88
|
+
expect(actualWarnings[i]).toMatchObject(expectedWarning);
|
|
89
|
+
}
|
|
93
90
|
|
|
94
91
|
if (!schema.fix) return;
|
|
95
92
|
|
|
@@ -122,10 +119,10 @@ module.exports = function getTestRule(options = {}) {
|
|
|
122
119
|
code: fixedCode,
|
|
123
120
|
});
|
|
124
121
|
|
|
125
|
-
expect(outputAfterLintOnFixedCode.results[0]
|
|
126
|
-
outputAfterFix.results[0].warnings,
|
|
127
|
-
|
|
128
|
-
|
|
122
|
+
expect(outputAfterLintOnFixedCode.results[0]).toMatchObject({
|
|
123
|
+
warnings: outputAfterFix.results[0].warnings,
|
|
124
|
+
parseErrors: [],
|
|
125
|
+
});
|
|
129
126
|
},
|
|
130
127
|
});
|
|
131
128
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-stylelint",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Jest preset for Stylelint plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stylelint",
|
|
@@ -55,18 +55,18 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@stylelint/prettier-config": "^2.0.0",
|
|
57
57
|
"@stylelint/remark-preset": "^3.0.0",
|
|
58
|
-
"@types/jest": "^
|
|
59
|
-
"eslint": "^8.
|
|
60
|
-
"eslint-config-stylelint": "^15.
|
|
61
|
-
"husky": "^
|
|
62
|
-
"jest": "^28.0
|
|
63
|
-
"lint-staged": "^
|
|
58
|
+
"@types/jest": "^28.1.1",
|
|
59
|
+
"eslint": "^8.17.0",
|
|
60
|
+
"eslint-config-stylelint": "^15.1.0",
|
|
61
|
+
"husky": "^8.0.1",
|
|
62
|
+
"jest": "^28.1.0",
|
|
63
|
+
"lint-staged": "^13.0.0",
|
|
64
64
|
"np": "^7.6.1",
|
|
65
65
|
"npm-run-all": "^4.1.5",
|
|
66
66
|
"prettier": "^2.6.2",
|
|
67
67
|
"remark-cli": "^10.0.1",
|
|
68
|
-
"stylelint": "^14.8.
|
|
69
|
-
"typescript": "^4.
|
|
68
|
+
"stylelint": "^14.8.5",
|
|
69
|
+
"typescript": "^4.7.3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"jest": "^25.3.0 || ^26.0.1 || ^27.0.1 || ^28.0.2"
|