Skip to content

Commit c64b6db

Browse files
committed
Create spec.stats.test.js
1 parent c63bfea commit c64b6db

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/spec.stats.test.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
const specFolderLocation = './spec_files';
4+
const splunkSpec = require("../out/spec.js");
5+
const extensionPath = path.resolve(__dirname, '../');
6+
const specFileVersion = "9.2";
7+
8+
let stanzaCount = 0
9+
let settingCount = 0
10+
11+
fs.readdir(path.join(specFolderLocation, specFileVersion), function(err, files) {
12+
let list = files.filter(item => !(/(^|\/)\.[^\/\.]/g).test(item))
13+
console.log('.spec file count: %d', list.length)
14+
list.forEach(function (file) {
15+
let specFilePath = path.join(specFolderLocation, specFileVersion, file)
16+
let specConfig = splunkSpec.getSpecConfig(extensionPath, specFilePath);
17+
stanzaCount = stanzaCount + specConfig.stanzas.length
18+
specConfig.stanzas.forEach(function (stanza) {
19+
settingCount = settingCount + stanza.settings.length
20+
})
21+
})
22+
23+
console.log('stanza count: %d', stanzaCount)
24+
console.log('setting count: %d', settingCount)
25+
})

0 commit comments

Comments
 (0)