diff --git a/README.md b/README.md index bcf0120..4356066 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The solutions are located under `/LeetcodeProblems`. Each problem has a test fil ### Run Tests -**Unit tests:** To run all the test run `node Test.js` in the console. To run a specific problem in your console run `node ` (e.g. `node LeetcodeProblems/Lowest_Common_Ancestor_of_a_Binary_Tree.js`). +**Unit tests:** To run all the test run `node Test.js` in the console. To run a specific problem in your console run `node Test.js ` (e.g. `node Test.js ./LeetcodeProblemsTests/Algorithms/easy/2Sum_Test.js`). **Linter:** This repository uses [`es-lint`](https://eslint.org/docs/latest/user-guide/command-line-interface). To run all the tests you would need to install the packages by running `npm install` followed by `npx eslint LeetcodeProblems LeetcodeProblemsTests` which will run the eslint in all problems and tests. You can also use the [flag `--fix`](https://eslint.org/docs/latest/user-guide/command-line-interface#fixing-problems) which will automatically fix some of the errors. diff --git a/Test.js b/Test.js index f96160f..a5f44f6 100644 --- a/Test.js +++ b/Test.js @@ -34,7 +34,7 @@ var solve = (problem) => { console.log("Solving: " + problem); const tests = require(problem); - console.log("*" * 100); + console.log("*".repeat(100)); if (Object.keys(tests).length == 0) { console.warn("🔴 The problem " + problem + " doesn't have a test method implemented.\n"); return; @@ -65,4 +65,10 @@ var loadProblemsFiles = (folder) => { }); }; -test_all(); +if (process.argv.length > 2) { + const path = process.argv.pop(); + solve(path); +} else { + test_all(); +} + \ No newline at end of file