Skip to content

Commit

Permalink
Merge pull request #1410 from snyk/chore/add-missing-test-suites
Browse files Browse the repository at this point in the history
Add missing test suites
  • Loading branch information
maxjeffos authored Sep 18, 2020
2 parents a4ce353 + ded859a commit 0a0193f
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 5 deletions.
11 changes: 9 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ module.exports = {
collectCoverage: false, // not collecting coverage for now
collectCoverageFrom: ['src/**/*.ts'],
coverageReporters: ['text-summary', 'html'],
testMatch: ['**/*.spec.ts'], // Remove when all tests are using Jest
modulePathIgnorePatterns: ['<rootDir>/test/.*fixtures'],
testMatch: [
'<rootDir>/test/*.spec.ts',
'<rootDir>\\test\\*.spec.ts', // for Windows
],
modulePathIgnorePatterns: [
'<rootDir>/test/.*fixtures',
'<rootDir>/test/acceptance/*',
'<rootDir>/test/acceptance/workspaces/*' // to avoid `jest-haste-map: Haste module naming collision` errors
],
};
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
"prepare": "npm run build",
"test:common": "npm run check-tests && npm run lint && node --require ts-node/register src/cli test --org=snyk",
"test:acceptance": "tap test/acceptance/**/*.test.* test/acceptance/*.test.* -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register",
"test:acceptance-windows": "tap test/acceptance/**/*.test.* -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register",
"test:system": "tap test/system/*.test.* -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register",
"test:jest": "jest test/*.spec.ts",
"test:jest": "jest",
"test:test": "tap test/*.test.* -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register",
"test": "npm run test:acceptance && npm run test:system && npm run test:jest",
"test-windows": "tap test/acceptance/**/*.test.* -Rspec --timeout=300 --node-arg=-r --node-arg=ts-node/register && npm run test:system && npm run test:test",
"test": "npm run test:acceptance && npm run test:system && npm run test:test && npm run test:jest",
"test-windows": "npm run test:acceptance-windows && npm run test:system && npm run test:test && npm run test:jest",
"lint": "run-p --aggregate-output lint:*",
"lint:js": "eslint --color --cache 'src/**/*.{js,ts}'",
"lint:formatting": "prettier --check '{src,test,scripts}/**/*.{js,ts}'",
Expand Down
10 changes: 10 additions & 0 deletions test/ecosystems.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import * as ecosystems from '../src/lib/ecosystems';
import * as request from '../src/lib/request/promise';
import { Options } from '../src/lib/types';
import { TestCommandResult } from '../src/cli/commands/types';
const osName = require('os-name');

const isWindows =
osName()
.toLowerCase()
.indexOf('windows') === 0;

describe('ecosystems', () => {
describe('getPlugin', () => {
Expand Down Expand Up @@ -48,6 +54,10 @@ describe('ecosystems', () => {
const cwd = process.cwd();

function readFixture(filename: string) {
if (isWindows) {
filename = filename.replace('.txt', '-windows.txt');
}

const filePath = path.join(fixturePath, filename);
return fs.readFileSync(filePath, 'utf-8');
}
Expand Down
15 changes: 15 additions & 0 deletions test/fixtures/cpp-project/debug-display-windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Fingerprints
52d1b046047db9ea0c581cafd4c68fe5 add.cpp
aeca71a6e39f99a24ecf4c088eee9cb8 add.h
ad3365b3370ef6b1c3e778f875055f19 main.cpp

Dependencies
[email protected]

Issues
✗ Cross-site Scripting (XSS) [medium]
https://snyk.io/vuln/cpp:add:20161130
in [email protected]
fix version 1.2.4

Tested 1 dependency for known issues, found 1 issue.
10 changes: 10 additions & 0 deletions test/fixtures/cpp-project/display-windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Dependencies
[email protected]

Issues
✗ Cross-site Scripting (XSS) [medium]
https://snyk.io/vuln/cpp:add:20161130
in [email protected]
fix version 1.2.4

Tested 1 dependency for known issues, found 1 issue.
2 changes: 2 additions & 0 deletions test/fixtures/cpp-project/error-windows.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Errors
Could not test dependencies in .

0 comments on commit 0a0193f

Please sign in to comment.