Skip to content

Commit

Permalink
fix: git-repos test inconsistant
Browse files Browse the repository at this point in the history
The git-repos test on Windows, Node 8 failing with connection timeouts.
Trying for loop instead of forEach inside try/catch and asserting response from test is truthy in an attempt to make test more consistent in this environment.
  • Loading branch information
gitphill committed Jan 24, 2020
1 parent 240f623 commit 132aae0
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions test/git-repos.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as cli from '../src/cli/commands/';
import * as tap from 'tap';
const test = tap.test;
import { test } from 'tap';

const urls = [
// a repo with no dependencies so it will never be vulnerable (2017-05-15)
Expand All @@ -10,14 +9,13 @@ const urls = [
'Snyk/vulndb-fixtures.git',
];

urls.forEach((url) => {
test('snyk.test supports ' + url + ' structure', async (t) => {
try {
await cli.test(url);
t.pass('url worked');
} catch (err) {
t.threw(err);
t.end();
test('snyk test supports different URLs', async (t) => {
try {
for (const url of urls) {
const res = await cli.test(url);
t.ok(res, `snyk test ${url} ok`);
}
});
} catch (err) {
t.fail('unexpected error thrown: ' + err.message);
}
});

0 comments on commit 132aae0

Please sign in to comment.