-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmain.js
44 lines (30 loc) · 1.02 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* NodeJS Test Generation Module
*/
// Core/NPM Modules
const path = require('path');
// Local Modules
const constraints = require('./src/constraint');
var testgenerator = require('./src/testgenerator');
const generateTestCases = testgenerator.generateTestCases;
// Polyfills
require('./src/format-polyfill');
/**
* Parse an input file and generate test cases for it.
*/
(module.exports.main = function() {
let testFilePath = [];
// Parse file input, defaulting to subject.js if not provided
let args = process.argv.slice(2);
if( args.length === 0 ) {
args = ["server.js", "mock_routes/admin.js", "mock_routes/study.js", "mock_routes/create.js"];
}
//let filePath = path.resolve(args[0]);
for(var i = 0; i < args.length; i++){
testFilePath.push(path.resolve(args[i]));
}
// Initialize constraints based on input file
let functionConstraints = constraints(testFilePath[0]);
// Generate test cases
generateTestCases(testFilePath, functionConstraints);
})();