Skip to content

Commit

Permalink
adding check (#1957)
Browse files Browse the repository at this point in the history
Signed-off-by: svetoslav-nikol0v <[email protected]>
  • Loading branch information
svetoslav-nikol0v authored Oct 4, 2023
1 parent 3ce2e32 commit f482908
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Variable used in script that runs all examples
NODE_COMMAND=node
7 changes: 6 additions & 1 deletion examples/run-all-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ const excludedDirectories = [
"./simple_rest_signature_provider",
];
const excludedJSFile = "run-all-examples.js";
const cmd = process.env.NODE_COMMAND;

fs.readdir(examplesDirectory, (err, files) => {
if (err) {
console.error("Error reading directory:", err);
return;
}

if (cmd === undefined) {
throw new Error("Environment variable NODE_COMMAND is required.");
}

let completed = 0;
let failed = 0;

Expand All @@ -43,7 +48,7 @@ fs.readdir(examplesDirectory, (err, files) => {
console.log(`\n⏳ ${index + 1}. Running ${file}...`);
const examplePath = path.join(examplesDirectory, file);

const result = spawnSync(process.env.NODE_COMMAND, [examplePath], {
const result = spawnSync(cmd, [examplePath], {
stdio: "ignore",
});

Expand Down

0 comments on commit f482908

Please sign in to comment.