Skip to content

Commit

Permalink
Test ESM rules
Browse files Browse the repository at this point in the history
Note that this change uses the unpublished version of `jest-preset-stylelint`:
stylelint/jest-preset-stylelint#81
  • Loading branch information
ybiquitous committed Nov 6, 2023
1 parent aa9be6f commit afd6a00
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 8 additions & 0 deletions jest.setup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import jestPreset from 'jest-preset-stylelint';

const { getTestRule, getTestRuleConfigs } = jestPreset;

const loadLint = () => import('./lib/index.mjs').then((m) => m.default.lint);

global.testRule = getTestRule({ loadLint });
global.testRuleConfigs = getTestRuleConfigs({ loadLint });
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@
},
"./lib/rules/*/index.mjs": {}
},
"moduleNameMapper": {
"^stylelint$": "<rootDir>/lib/index.cjs"
},
"preset": "jest-preset-stylelint",
"roots": [
"lib",
"system-tests"
],
"setupFiles": [
"<rootDir>/jest.setup.mjs"
],
"testEnvironment": "node",
"testRegex": ".*\\.test\\.m?js$|rules/.*/__tests__/.*\\.m?js$",
"watchPlugins": [
Expand Down

0 comments on commit afd6a00

Please sign in to comment.