Skip to content

Commit

Permalink
Added Env vars testing + notEval option for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mapoart committed Mar 20, 2020
1 parent d4093b5 commit f7c84d2
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
5 changes: 4 additions & 1 deletion nexss-test/commands/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ testNames.forEach(test => {
}

test.tests.forEach(subtest => {
if (test.notEval && !subtest.notEval) {
subtest.notEval = test.notEval;
}
tests++;
if (cliArgs.startFromTest) {
if (isNaN(cliArgs.startFromTest)) {
Expand All @@ -158,7 +161,7 @@ testNames.forEach(test => {
console.log(`===========================================`);
eval(subtest.type || "shouldContain")(
...subtest.params.map(p => {
if (p !== null && typeof p === "object") {
if ((p !== null && typeof p === "object") || subtest.notEval) {
return p;
} else {
return evalTS(p);
Expand Down
52 changes: 52 additions & 0 deletions nexss-test/tests/env.nexss-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
let values = ["Nexss"];

module.exports = {
values,
startFrom: "",
endsWith: "",
omit: [],
tests: [
{
title: "NEXSS_ environment variables",
onError: "stop", // global value,
notEval: true, // Means that parameters will not be evaluated (like below it ${..} will be passed)
tests: [
{
title: "NEXSS_APPS_PATH",
params: [
"nexss id --testEnv=${process.env.NEXSS_APPS_PATH}",
/"testEnv":".*\\\\\.nexssApps/
]
},
{
title: "NEXSS_LANGUAGES_PATH",
params: [
"nexss id --testEnv=${process.env.NEXSS_LANGUAGES_PATH}",
/"testEnv":".*\\\\\.nexss\\\\languages/
]
},
{
title: "NEXSS_HOME_PATH",
params: [
"nexss id --testEnv=${process.env.NEXSS_HOME_PATH}",
/"testEnv":".*\\\\\.nexss"/
]
}
]
}
// {
// title: "nexss-command",
// onError: "stop", // global value
// tests: [
// {
// title: "Check not in the folder",
// type: "shouldContain",
// params: [
// "nexss cmd",
// "You are not in the Nexss Programmer project folder."
// ]
// }
// ]
// }
]
};

0 comments on commit f7c84d2

Please sign in to comment.