File tree 1 file changed +13
-0
lines changed 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { ValidateInput } from "code-skeleton/lib/generators/abstract" ;
1
2
import { Generator } from "code-skeleton/lib/generators/abstract" ;
2
3
import { readFile } from "node:fs/promises" ;
3
4
import Mustache from "mustache" ;
@@ -25,6 +26,18 @@ class MustacheGenerator extends Generator<MustacheGeneratorOptions> {
25
26
const rendered = Mustache . render ( source . toString ( ) , this . options . variables ) ;
26
27
return rendered ;
27
28
}
29
+
30
+ async validate ( options : ValidateInput ) : Promise < void > {
31
+ const expected = await this . generate ( ) ;
32
+
33
+ if ( ! options . found . includes ( expected ) ) {
34
+ this . report ( {
35
+ expected,
36
+ found : options . found ,
37
+ message : `${ this . options . path } does not include the original template`
38
+ } ) ;
39
+ }
40
+ }
28
41
}
29
42
30
43
export function mustache ( options : MustacheGeneratorOptions ) {
You can’t perform that action at this time.
0 commit comments