-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request snyk#1007 from snyk/feat/drop-tape
fix: drop tape
- Loading branch information
Showing
26 changed files
with
247 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { test } from 'tap'; | ||
import * as snyk from '../src/lib'; | ||
|
||
test('does it load', async (t) => { | ||
t.assert(snyk, 'snyk loaded'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { test } from 'tap'; | ||
import * as path from 'path'; | ||
import * as snyk from '../src/lib'; | ||
|
||
const cwd = process.cwd(); | ||
const osDir = path.resolve(__dirname, 'fixtures', 'demo-private'); | ||
|
||
async function runTests(t, error, modules) { | ||
const expectedModules = { | ||
express: '3.21.1', | ||
autocache: '0.6.1', | ||
less: '2.5.1', | ||
marked: '0.2.10', | ||
'demo-private': null, | ||
}; | ||
|
||
if (error) { | ||
t.fail(error.message); | ||
} | ||
t.ok(!error, 'module reading did not error'); | ||
t.ok(typeof modules === 'object', 'modules is an object'); | ||
|
||
const keys = Object.keys(modules.dependencies); | ||
const count = keys.length; | ||
t.equal(count, 4, 'dep count'); | ||
|
||
keys.forEach((key) => { | ||
t.ok(expectedModules[key] !== undefined, key + ' was expected'); | ||
|
||
// special case for demo-private - as it doesn't have a version | ||
if (key === 'demo-private') { | ||
t.equal(modules[key].version, null, 'no version on demo-private'); | ||
t.equal(modules[key].valid, undefined, 'no dep test on demo-private'); | ||
} else { | ||
t.equal( | ||
expectedModules[key], | ||
modules.dependencies[key].version, | ||
key + ' version is correct', | ||
); | ||
t.equal( | ||
modules.dependencies[key].valid, | ||
true, | ||
key + ' version was satisfied WRT dep', | ||
); | ||
} | ||
}); | ||
} | ||
|
||
test('module reporting: private project', async (t) => { | ||
t.test('specified directory', async (t) => { | ||
const modules = await snyk.modules(osDir); | ||
await runTests(t, null, modules); | ||
}); | ||
|
||
t.test('inferred directory', async (t) => { | ||
process.chdir(osDir); | ||
|
||
const modules = await snyk.modules('.'); | ||
await runTests(t, null, modules); | ||
}); | ||
}); | ||
|
||
test('teardown', async (t) => { | ||
process.chdir(cwd); | ||
t.pass('reset cwd'); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { test } from 'tap'; | ||
import * as path from 'path'; | ||
import * as snyk from '../src/lib'; | ||
|
||
const osDir = path.resolve(__dirname, 'fixtures', 'no-deps'); | ||
|
||
test('works when there are no dependencies', async (t) => { | ||
try { | ||
const modules = await snyk.modules(osDir); | ||
t.ok(true, 'modules did not bail'); | ||
t.deepEqual(modules.dependencies, {}); | ||
} catch (e) { | ||
t.fail('Should have passed:' + e); | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as policy from 'snyk-policy'; | ||
import { test } from 'tap'; | ||
import { loadJson } from './utils'; | ||
|
||
test('test sensibly bails if gets an old .snyk format', async (t) => { | ||
try { | ||
const vulns2 = loadJson( | ||
__dirname + '/fixtures/test-jsbin-vulns-updated.json', | ||
); | ||
const config = await policy.load(__dirname + '/fixtures/old-snyk-config'); | ||
const res = await config.filter(vulns2); | ||
t.fail('was expecting an error, got ' + JSON.stringify(res)); | ||
} catch (e) { | ||
t.equal(e.code, 'OLD_DOTFILE_FORMAT'); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.