22"use strict" ;
33import assert from "power-assert" ;
44import fs from "fs" ;
5- import { TextLintCore } from "textlint" ;
6- import rule from "../src/prh -rule" ;
5+ import { TextLintEngine , TextLintCore } from "textlint" ;
6+ import rule from "../src/textlint -rule-prh " ;
77import path from "path" ;
8- describe ( ".textlinrc test" , function ( ) {
9- context ( "when use .textlintrc" , function ( ) {
10- it ( "should resolve path to rule.yaml" , function ( ) {
11- var textlint = new TextLintCore ( ) ;
12- textlint . setupRules ( {
13- "prh" : rule
14- } , {
15- "prh" : {
16- "rulePaths" : [ path . join ( __dirname , "fixtures" , "rule.yaml" ) , path . join ( __dirname , "fixtures" , "imports.yml" ) ]
17- }
8+
9+ describe ( ".textlinrc test" , function ( ) {
10+ context ( "when use .textlintrc" , function ( ) {
11+ it ( "should resolve path to rule.yaml" , function ( ) {
12+ const engine = new TextLintEngine ( {
13+ configFile : path . join ( __dirname , "fixtures/.textlintrc" ) ,
14+ rulesBaseDirectory : path . join ( __dirname , "../src" )
1815 } ) ;
19- return textlint . lintMarkdown ( "jquery" ) . then ( result => {
16+ return engine . executeOnText ( "jquery" ) . then ( ( [ result ] ) => {
2017 assert ( result . messages . length === 1 ) ;
2118 assert ( result . messages [ 0 ] . line === 1 ) ;
2219 assert ( result . messages [ 0 ] . column === 1 ) ;
2320 } ) ;
2421 } ) ;
25- it ( "should resolve path to rule.yaml" , function ( ) {
22+ } ) ;
23+ context ( "options" , ( ) => {
24+ it ( "should resolve path to rule.yaml" , function ( ) {
2625 var textlint = new TextLintCore ( ) ;
2726 textlint . setupRules ( {
2827 "prh" : rule
@@ -37,7 +36,7 @@ describe(".textlinrc test", function () {
3736 assert ( result . messages [ 0 ] . column === 1 ) ;
3837 } ) ;
3938 } ) ;
40- it ( "should resolve yaml content" , function ( ) {
39+ it ( "should resolve yaml content" , function ( ) {
4140 var textlint = new TextLintCore ( ) ;
4241 var content = fs . readFileSync ( path . join ( __dirname , "fixtures" , "rule.yaml" ) , "utf-8" ) ;
4342 textlint . setupRules ( {
@@ -53,7 +52,7 @@ describe(".textlinrc test", function () {
5352 assert ( result . messages [ 0 ] . column === 1 ) ;
5453 } ) ;
5554 } ) ;
56- it ( "should resolve yaml file and content" , function ( ) {
55+ it ( "should resolve yaml file and content" , function ( ) {
5756 var textlint = new TextLintCore ( ) ;
5857 var content = fs . readFileSync ( path . join ( __dirname , "fixtures" , "rule.yaml" ) , "utf-8" ) ;
5958 textlint . setupRules ( {
@@ -74,11 +73,11 @@ describe(".textlinrc test", function () {
7473 assert ( result . messages [ 1 ] . column === 8 ) ;
7574 } ) ;
7675 } ) ;
77-
7876 } ) ;
79- context ( "prh features" , function ( ) {
80- describe ( "import" , function ( ) {
81- it ( "should work import directive" , function ( ) {
77+
78+ context ( "prh features" , function ( ) {
79+ describe ( "import" , function ( ) {
80+ it ( "should work import directive" , function ( ) {
8281 var textlint = new TextLintCore ( ) ;
8382 textlint . setupRules ( {
8483 "prh" : rule
0 commit comments