22// https://github.com/ember-template-lint/ember-template-lint/blob/v1.3.0/lib/helpers/rule-test-harness.js
33const plugin = require ( "../../ember-template-lint-plugin-prettier" ) ;
44
5- const fs = require ( "fs" ) ;
65const assert = require ( "assert" ) ;
76
87const Linter = require ( "ember-template-lint" ) ;
@@ -30,8 +29,7 @@ function generateRuleTests({
3029 groupingMethod ( name , function ( ) {
3130 let linter , config , meta ;
3231
33- function verify ( path ) {
34- const template = fs . readFileSync ( path , { encoding : "utf8" } ) ;
32+ function verify ( template ) {
3533 linter . config . rules [ name ] = config ;
3634 return linter . verify ( { source : template , moduleId : meta . moduleId } ) ;
3735 }
@@ -69,10 +67,10 @@ function generateRuleTests({
6967 }
7068
7169 bad . forEach ( function ( badItem ) {
72- let path = badItem . path ;
70+ let template = badItem . template ;
7371
7472 testMethod (
75- `logs a message in the console when given \`${ path } \`` ,
73+ `logs a message in the console when given \`${ template } \`` ,
7674 function ( ) {
7775 let expectedResults = badItem . results || [ badItem . result ] ;
7876
@@ -82,7 +80,7 @@ function generateRuleTests({
8280 config = badItem . config ;
8381 }
8482
85- let actual = verify ( path ) ;
83+ let actual = verify ( template ) ;
8684
8785 if ( badItem . fatal ) {
8886 assert . strictEqual ( actual . length , 1 ) ; // can't have more than one fatal error
@@ -97,20 +95,23 @@ function generateRuleTests({
9795 ) ;
9896
9997 if ( ! skipDisabledTests ) {
100- testMethod ( `passes with \`${ path } \` when rule is disabled` , function ( ) {
101- config = false ;
102- meta = parseMeta ( badItem ) ;
103- let actual = verify ( path ) ;
104-
105- assert . deepStrictEqual ( actual , [ ] ) ;
106- } ) ;
98+ testMethod (
99+ `passes with \`${ template } \` when rule is disabled` ,
100+ function ( ) {
101+ config = false ;
102+ meta = parseMeta ( badItem ) ;
103+ let actual = verify ( template ) ;
104+
105+ assert . deepStrictEqual ( actual , [ ] ) ;
106+ }
107+ ) ;
107108 }
108109 } ) ;
109110
110111 good . forEach ( function ( goodItem ) {
111- let path = goodItem . path ;
112+ let template = goodItem . template ;
112113
113- testMethod ( `passes when given \`${ path } \`` , function ( ) {
114+ testMethod ( `passes when given \`${ template } \`` , function ( ) {
114115 meta = parseMeta ( goodItem ) ;
115116 let actual ;
116117
@@ -121,7 +122,7 @@ function generateRuleTests({
121122 config = goodItem . config ;
122123 }
123124
124- actual = verify ( path ) ;
125+ actual = verify ( template ) ;
125126 }
126127
127128 assert . deepStrictEqual ( actual , [ ] ) ;
0 commit comments