|
1 | 1 | // LICENSE : MIT |
2 | 2 | "use strict"; |
3 | 3 | import assert from "power-assert"; |
4 | | -import {textlint} from "textlint"; |
| 4 | +import {TextLintCore} from "textlint"; |
5 | 5 | import rule from "../src/prh-rule"; |
6 | 6 | import path from "path"; |
7 | 7 | describe(".textlinrc test", function () { |
8 | 8 | context("when use .textlintrc", function () { |
9 | 9 | it("should resolve path to rule.yaml", function () { |
| 10 | + var textlint = new TextLintCore(); |
10 | 11 | textlint.setupRules({ |
11 | 12 | "prh": rule |
12 | 13 | }, { |
13 | 14 | "prh": { |
14 | 15 | "rulePaths": [path.join(__dirname, "fixtures", "rule.yaml")] |
15 | 16 | } |
16 | | - }, { |
17 | | - "configFile": path.join(__dirname, "fixtures", ".textlintrc") |
18 | 17 | }); |
19 | 18 | var result = textlint.lintMarkdown("jquery"); |
20 | 19 | assert(result.messages.length === 1); |
21 | 20 | assert(result.messages[0].line === 1); |
22 | 21 | assert(result.messages[0].column === 1); |
23 | | - textlint.resetRules(); |
24 | 22 | }); |
25 | 23 | it("should resolve path to rule.yaml", function () { |
| 24 | + var textlint = new TextLintCore(); |
26 | 25 | textlint.setupRules({ |
27 | 26 | "prh": rule |
28 | 27 | }, { |
29 | 28 | "prh": { |
30 | 29 | "rulePaths": [path.join(__dirname, "fixtures", "rule.yaml")] |
31 | 30 | } |
32 | | - }, { |
33 | | - "configFile": path.join(__dirname, "fixtures", ".textlintrc") |
34 | 31 | }); |
35 | 32 | var result = textlint.lintMarkdown("jquery"); |
36 | 33 | assert(result.messages.length === 1); |
37 | 34 | assert(result.messages[0].line === 1); |
38 | 35 | assert(result.messages[0].column === 1); |
39 | | - textlint.resetRules(); |
| 36 | + }); |
| 37 | + }); |
| 38 | + context("prh features", function () { |
| 39 | + describe("import", function () { |
| 40 | + it("should work import directive", function () { |
| 41 | + var textlint = new TextLintCore(); |
| 42 | + textlint.setupRules({ |
| 43 | + "prh": rule |
| 44 | + }, { |
| 45 | + "prh": { |
| 46 | + "rulePaths": [path.join(__dirname, "fixtures", "imports.yml")] |
| 47 | + } |
| 48 | + }); |
| 49 | + var result = textlint.lintMarkdown("A"); |
| 50 | + assert(result.messages.length === 1); |
| 51 | + var message = result.messages[0].message; |
| 52 | + assert.equal(message, "A => a"); |
| 53 | + var resultB = textlint.lintMarkdown("B"); |
| 54 | + assert(resultB.messages.length === 1); |
| 55 | + var messageB = resultB.messages[0].message; |
| 56 | + assert.equal(messageB, "B => b"); |
| 57 | + }); |
40 | 58 | }); |
41 | 59 | }); |
42 | 60 | }); |
0 commit comments