Skip to content

Commit

Permalink
Create spec.stats.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonConger committed May 21, 2024
1 parent c63bfea commit c64b6db
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/spec.stats.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const fs = require('fs');
const path = require('path');
const specFolderLocation = './spec_files';
const splunkSpec = require("../out/spec.js");
const extensionPath = path.resolve(__dirname, '../');
const specFileVersion = "9.2";

let stanzaCount = 0
let settingCount = 0

fs.readdir(path.join(specFolderLocation, specFileVersion), function(err, files) {
let list = files.filter(item => !(/(^|\/)\.[^\/\.]/g).test(item))
console.log('.spec file count: %d', list.length)
list.forEach(function (file) {
let specFilePath = path.join(specFolderLocation, specFileVersion, file)
let specConfig = splunkSpec.getSpecConfig(extensionPath, specFilePath);
stanzaCount = stanzaCount + specConfig.stanzas.length
specConfig.stanzas.forEach(function (stanza) {
settingCount = settingCount + stanza.settings.length
})
})

console.log('stanza count: %d', stanzaCount)
console.log('setting count: %d', settingCount)
})

0 comments on commit c64b6db

Please sign in to comment.