This repository has been archived by the owner on Mar 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
59 lines (55 loc) · 1.76 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
var stylelint = require('stylelint');
var test = require('tape');
function assertEquality(processCss, context) {
var testFn = (context.only) ? test.only : test;
testFn(context.caseDescription, function(t) {
t.plan(context.comparisonCount);
processCss.then(function(comparisons) {
comparisons.forEach(function(comparison) {
t.equal(comparison.actual, comparison.expected, comparison.description);
});
});
});
}
module.exports = stylelint.createRuleTester(assertEquality);
// Anybody want to use another test engine?
//
// Here are some possible modules:
//
// AVA rule tester
//
// import createStylelintRuleTester from "./createStylelintRuleTester"
// import test from "ava"
//
// function assertEquality(processCss, context) {
// const testFn = (context.only) ? test.only : test
// testFn(context.caseDescription, t => {
// return processCss.then((comparisons) => {
// comparisons.forEach(({ actual, expected, description }) => {
// t.is(actual, expected, description)
// })
// })
// })
// }
//
// export default createStylelintRuleTester(assertEquality)
// Mocha rule tester
//
// import createStylelintRuleTester from "./createStylelintRuleTester"
// import assert from "assert"
//
// function assertEquality(processCss, context) {
// const describeFn = (context.only) ? describe.only : describe
// describeFn(context.caseDescription, () => {
// it(context.completeAssertionDescription, done => {
// processCss.then((comparisons) => {
// comparisons.forEach(({ actual, expected, description }) => {
// assert.equal(actual, expected, description)
// })
// done()
// }).catch(done)
// })
// })
// }
//
// export default createStylelintRuleTester(assertEquality)