2.1.7 • Published 2 years ago

stylelint-jest-rule-tester v2.1.7

Weekly downloads
892
License
MIT
Repository
github
Last release
2 years ago

Stylelint Jest Rule Tester

This is not an official stylelint package.

tests

Simple function written in TypeScript to test custom stylelint plugin rules.

Largely influenced by jest-preset-stylelint/getTestRule.js.

Usage

This is from this project's test file.

import {testRule} from 'stylelint-jest-rule-tester';
import {visibilityRule} from './visibility.rule';

testRule({
    // replace this name with your rule's name
    ruleName: visibilityRule.ruleName,
    description: 'should work primary option in array',
    ruleOptions: [true],
    // a plugin must be supplied so that stylelint can find the rule you want to test
    linterOptions: {config: {plugins: ['./dist/test/plugins.js']}},
    fix: true,
    accept: [
        {
            code: 'a { color: pink; }',
        },
    ],
    reject: [
        {
            code: 'a { color: pink; visibility: hidden; }',
            fixed: 'a { color: pink; }',
            message: visibilityRule.message,
        },
    ],
});
2.1.7

2 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.2

3 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago