diff --git a/.gitignore b/.gitignore index 11f57149..d7c53d50 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ tmp/ .idea/ vendor/ .bundle -out \ No newline at end of file +out +.vscode/ diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 17bf1601..00000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - // Use IntelliSense to learn about possible Node.js debug attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Run mocha", - "type": "node", - "request": "launch", - "program": "${workspaceRoot}/node_modules/mocha/bin/_mocha", - "stopOnEntry": false, - - "args": ["${file}", "--no-timeouts"], - - "cwd": "${workspaceRoot}", - "runtimeExecutable": null, - "env": { "NODE_ENV": "testing"} - }, - { - "type": "node", - "request": "launch", - "name": "Launch Program", - "program": "${workspaceRoot}/bin/repolinter.js", - "args":[ - "lint", - "--git", - "https://github.com/todogroup/repolinter.git" - ] - } - ] -} diff --git a/index.js b/index.js index b8aa9c0f..8af7c044 100644 --- a/index.js +++ b/index.js @@ -357,7 +357,6 @@ async function runRuleset (ruleset, targets, fileSystem, dryRun) { const allRules = await loadRules() // load the fixes const allFixes = await loadFixes() - // do the same with fixes // run the ruleset const results = ruleset.map(async r => { // check axioms and enable appropriately diff --git a/tests/lib/command_exists_tests.js b/tests/lib/command_exists_tests.js new file mode 100644 index 00000000..70d98ebc --- /dev/null +++ b/tests/lib/command_exists_tests.js @@ -0,0 +1,35 @@ +// Copyright 2017 TODO Group. All rights reserved. +// SPDX-License-Identifier: Apache-2.0 + +const chai = require('chai') +const expect = chai.expect +const { commandExists } = require('../../lib/command_exists') + +describe('lib', () => { + describe('command_exists', function () { + it('should detect a command exists', async () => { + const res = await commandExists('ssh') + expect(res).to.equal('ssh') + }) + + it('should detect a command doesn\'t exists', async () => { + const res = await commandExists('notacommand') + expect(res).to.equal(null) + }) + + it('should detect one of the commands exist', async () => { + const res = await commandExists(['notacommand', 'ssh']) + expect(res).to.equal('ssh') + }) + + it('should detect none of the commands exist', async () => { + const res = await commandExists(['notacommand', 'alsonotacommand']) + expect(res).to.equal(null) + }) + + it('should detect the first command exists', async () => { + const res = await commandExists(['ssh', 'ln']) + expect(res).to.equal('ssh') + }) + }) +})