How to use the stylelint.createRuleTester function in stylelint

To help you get started, we’ve selected a few stylelint examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / stylelint / stylelint-tests.ts View on Github external
utils.report({
                ruleName,
                result,
                message: messages.warning(warning),
                node: root,
                index: 1,
                word: "foo",
                line: 2,
            });
        });
    };
};

createPlugin(ruleName, testPlugin);

const tester = createRuleTester(
    (result: Promise, context: RuleTesterContext) => {
        return;
    }
);

tester(testPlugin, {
    ruleName: 'foo',
    config: [true, 1],
    accept: [
        { code: 'test' },
        { code: 'test2', description: 'testing' }
    ],
    reject: [
        { code: 'testreject', line: 1, column: 1 },
        { code: 'test2reject', message: 'x', line: 1, column: 1 }
    ]
github liferay / liferay-frontend-source-formatter / test / stylelint_rule_tester.js View on Github external
var actual = item.actual;
									var expected = item.expected;
									var description = item.description;

									assert.equal(actual, expected, description);
								}
							);
						}
					);
				}
			);
		}
	);
}

module.exports = stylelint.createRuleTester(assertEquality);

module.exports.stylelint = stylelint;