chore: restructure bru js package

This commit is contained in:
Anoop M D 2023-02-06 15:24:34 +05:30
parent 827c480689
commit c8de57aa51
11 changed files with 10 additions and 3 deletions

View File

@ -37,6 +37,8 @@ const bruToJson = (bru) => {
"params": _.get(json, "query", []),
"headers": _.get(json, "headers", []),
"body": _.get(json, "body", {}),
"vars": _.get(json, "vars", []),
"assert": _.get(json, "assert", []),
"script": _.get(json, "script", ""),
"tests": _.get(json, "tests", "")
}

View File

@ -78,7 +78,9 @@ const runSingleRequest = async function (filename, collectionPath, collectionVar
testResults = get(result, 'results', []);
}
console.log(chalk.blue(stripExtension(filename)) + chalk.dim(` (${response.status} ${response.statusText})`));
console.log(JSON.stringify(bruJson, null, 2));
console.log(chalk.green(stripExtension(filename)) + chalk.dim(` (${response.status} ${response.statusText})`));
if(testResults && testResults.length) {
each(testResults, (testResult) => {
if(testResult.status === 'pass') {

View File

@ -8,5 +8,8 @@
],
"peerDependencies": {
"vm2": "^3.9.13"
},
"dependencies": {
"json-query": "^2.2.2"
}
}

View File

@ -1,10 +1,10 @@
const {
ScriptRuntime
} = require('./scripts/script-runtime');
} = require('./script-runtime');
const {
TestRuntime
} = require('./scripts/test-runtime');
} = require('./test-runtime');
module.exports = {
ScriptRuntime,