jest-preset-stylelint 6.1.0 → 6.1.1
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 +8 -3
- package/jest-preset.js +1 -0
- package/jest-setup-after-env.js +18 -0
- package/jest-setup.js +0 -3
- package/package.json +13 -12
package/getTestRule.js
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
const util = require('util');
|
|
4
4
|
|
|
5
|
-
// @ts-expect-error -- TS2614: Module '"stylelint"' has no exported member 'lint'. Did you mean to use 'import lint from "stylelint"' instead?
|
|
6
|
-
const { lint } = require('stylelint'); // eslint-disable-line node/no-unpublished-require -- Avoid auto-install of `stylelint` peer dependency.
|
|
7
|
-
|
|
8
5
|
/**
|
|
9
6
|
* @typedef {import('.').TestCase} TestCase
|
|
10
7
|
* @typedef {import('.').TestSchema} TestSchema
|
|
@@ -13,6 +10,14 @@ const { lint } = require('stylelint'); // eslint-disable-line node/no-unpublishe
|
|
|
13
10
|
/** @type {import('.').getTestRule} */
|
|
14
11
|
module.exports = function getTestRule(options = {}) {
|
|
15
12
|
return function testRule(schema) {
|
|
13
|
+
/** @type {import('stylelint').lint} */
|
|
14
|
+
let lint;
|
|
15
|
+
|
|
16
|
+
beforeAll(() => {
|
|
17
|
+
// eslint-disable-next-line n/no-unpublished-require -- Avoid auto-install of `stylelint` peer dependency.
|
|
18
|
+
lint = require('stylelint').lint;
|
|
19
|
+
});
|
|
20
|
+
|
|
16
21
|
describe(`${schema.ruleName}`, () => {
|
|
17
22
|
const stylelintConfig = {
|
|
18
23
|
plugins: options.plugins || schema.plugins,
|
package/jest-preset.js
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
const eolDescriptor = Object.getOwnPropertyDescriptor(os, 'EOL');
|
|
6
|
+
|
|
7
|
+
if (!eolDescriptor) {
|
|
8
|
+
throw new TypeError('`os` must have an `EOL` property');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
beforeAll(() => {
|
|
12
|
+
// NOTE: `jest.replaceProperty()` is unavailable for a read-only property.
|
|
13
|
+
Object.defineProperty(os, 'EOL', { ...eolDescriptor, value: '\n' });
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
afterAll(() => {
|
|
17
|
+
Object.defineProperty(os, 'EOL', eolDescriptor);
|
|
18
|
+
});
|
package/jest-setup.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-preset-stylelint",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"description": "Jest preset for Stylelint plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"stylelint",
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"getTestRule.js",
|
|
18
18
|
"jest-preset.js",
|
|
19
19
|
"jest-setup.js",
|
|
20
|
+
"jest-setup-after-env.js",
|
|
20
21
|
"index.d.ts"
|
|
21
22
|
],
|
|
22
23
|
"scripts": {
|
|
@@ -55,21 +56,21 @@
|
|
|
55
56
|
]
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
|
-
"@stylelint/prettier-config": "^
|
|
59
|
+
"@stylelint/prettier-config": "^3.0.0",
|
|
59
60
|
"@stylelint/remark-preset": "^4.0.0",
|
|
60
|
-
"@types/jest": "^29.
|
|
61
|
-
"eslint": "^8.
|
|
62
|
-
"eslint-config-stylelint": "^
|
|
63
|
-
"eslint-plugin-jest": "^27.2.
|
|
61
|
+
"@types/jest": "^29.5.3",
|
|
62
|
+
"eslint": "^8.45.0",
|
|
63
|
+
"eslint-config-stylelint": "^19.0.0",
|
|
64
|
+
"eslint-plugin-jest": "^27.2.3",
|
|
64
65
|
"husky": "^8.0.3",
|
|
65
|
-
"jest": "^29.
|
|
66
|
-
"lint-staged": "^13.
|
|
67
|
-
"np": "^
|
|
66
|
+
"jest": "^29.6.1",
|
|
67
|
+
"lint-staged": "^13.2.3",
|
|
68
|
+
"np": "^8.0.4",
|
|
68
69
|
"npm-run-all": "^4.1.5",
|
|
69
|
-
"prettier": "^
|
|
70
|
+
"prettier": "^3.0.0",
|
|
70
71
|
"remark-cli": "^11.0.0",
|
|
71
|
-
"stylelint": "^15.
|
|
72
|
-
"typescript": "^
|
|
72
|
+
"stylelint": "^15.10.2",
|
|
73
|
+
"typescript": "^5.1.6"
|
|
73
74
|
},
|
|
74
75
|
"peerDependencies": {
|
|
75
76
|
"jest": "^29.0.2"
|