@@ -33,15 +33,15 @@ describe('Tests for the getName method of PmdEngine', () => {
3333
3434
3535describe ( 'Tests for the describeRules method of PmdEngine' , ( ) => {
36- it ( 'When using defaults without workspace, then apex and visualforce rules are returned' , async ( ) => {
36+ it ( 'When using defaults without workspace, then all language rules are returned' , async ( ) => {
3737 const engine : PmdEngine = new PmdEngine ( DEFAULT_PMD_ENGINE_CONFIG ) ;
3838 const logEvents : LogEvent [ ] = [ ] ;
3939 engine . onEvent ( EventType . LogEvent , ( e : LogEvent ) => logEvents . push ( e ) ) ;
4040 const progressEvents : DescribeRulesProgressEvent [ ] = [ ] ;
4141 engine . onEvent ( EventType . DescribeRulesProgressEvent , ( e : DescribeRulesProgressEvent ) => progressEvents . push ( e ) ) ;
4242
4343 const ruleDescriptions : RuleDescription [ ] = await engine . describeRules ( { } ) ;
44- await expectRulesToMatchGoldFile ( ruleDescriptions , 'rules_apexAndVisualforce .goldfile.json' ) ;
44+ await expectRulesToMatchGoldFile ( ruleDescriptions , 'rules_allLanguages .goldfile.json' ) ;
4545
4646 // Also check that we have fine logs with the argument list and the duration in milliseconds
4747 const fineLogEvents : LogEvent [ ] = logEvents . filter ( e => e . logLevel === LogLevel . Fine ) ;
@@ -66,11 +66,21 @@ describe('Tests for the describeRules method of PmdEngine', () => {
6666 await expectRulesToMatchGoldFile ( ruleDescriptions , 'rules_apexOnly.goldfile.json' ) ;
6767 } ) ;
6868
69- it ( 'When using defaults with workspace containing only apex and xml code, then only apex rules are returned' , async ( ) => {
69+ it ( 'When using defaults with workspace containing only apex and visualforce code, then only apex and visualforce rules are returned' , async ( ) => {
7070 const engine : PmdEngine = new PmdEngine ( DEFAULT_PMD_ENGINE_CONFIG ) ;
7171 const workspace : Workspace = new Workspace ( [
7272 path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.trigger' ) ,
73- path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.xml' )
73+ path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.page' )
74+ ] ) ;
75+ const ruleDescriptions : RuleDescription [ ] = await engine . describeRules ( { workspace : workspace } ) ;
76+ await expectRulesToMatchGoldFile ( ruleDescriptions , 'rules_apexAndVisualforce.goldfile.json' ) ;
77+ } ) ;
78+
79+ it ( 'When using defaults with workspace containing only apex and text files, then only apex rules are returned' , async ( ) => {
80+ const engine : PmdEngine = new PmdEngine ( DEFAULT_PMD_ENGINE_CONFIG ) ;
81+ const workspace : Workspace = new Workspace ( [
82+ path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.trigger' ) ,
83+ path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.txt' )
7484 ] ) ;
7585 const ruleDescriptions : RuleDescription [ ] = await engine . describeRules ( { workspace : workspace } ) ;
7686 await expectRulesToMatchGoldFile ( ruleDescriptions , 'rules_apexOnly.goldfile.json' ) ;
@@ -393,7 +403,7 @@ describe('Tests for the runRules method of PmdEngine', () => {
393403 const progressEvents : RunRulesProgressEvent [ ] = [ ] ;
394404 engine . onEvent ( EventType . RunRulesProgressEvent , ( e : RunRulesProgressEvent ) => progressEvents . push ( e ) ) ;
395405
396- const workspace : Workspace = new Workspace ( [ path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.xml ' ) ] ) ;
406+ const workspace : Workspace = new Workspace ( [ path . join ( TEST_DATA_FOLDER , 'samplePmdWorkspace' , 'dummy.txt ' ) ] ) ;
397407 const ruleNames : string [ ] = [ 'OperationWithLimitsInLoop' , 'VfUnescapeEl' ] ;
398408 const results : EngineRunResults = await engine . runRules ( ruleNames , { workspace : workspace } ) ;
399409
0 commit comments