Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update: More detailed assert message for rule-tester
- Loading branch information
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @fileoverview Tests for RuleTester without any test runner | ||
* @author Weijia Wang <starkwang@126.com> | ||
*/ | ||
"use strict"; | ||
|
||
/* global describe, it */ | ||
/* eslint-disable no-global-assign*/ | ||
const assert = require("assert"), | ||
RuleTester = require("../../../lib/testers/rule-tester"); | ||
const tmpIt = it; | ||
const tmpDescribe = describe; | ||
|
||
it = null; | ||
describe = null; | ||
|
||
const ruleTester = new RuleTester(); | ||
|
||
assert.throws(() => { | ||
ruleTester.run("no-var", require("../../fixtures/testers/rule-tester/no-var"), { | ||
valid: [ | ||
"bar = baz;" | ||
], | ||
invalid: [ | ||
{ code: "var foo = bar;", output: "invalid output", errors: 1 } | ||
] | ||
}); | ||
}, /' foo = bar;' == 'invalid output'/); | ||
|
||
it = tmpIt; | ||
describe = tmpDescribe; |