Skip to content

Commit

Permalink
Merge pull request #1656 from snyk/feat/protect-prime-time
Browse files Browse the repository at this point in the history
Snyk protect prime time
  • Loading branch information
maxjeffos authored Mar 1, 2021
2 parents 3021bb2 + 69cd590 commit ebb8dd7
Show file tree
Hide file tree
Showing 84 changed files with 317,743 additions and 251 deletions.
61 changes: 49 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ defaults: &defaults
system_tests:
type: boolean
default: false
package_tests:
type: boolean
default: false
working_directory: ~/snyk

windows_defaults: &windows_defaults
Expand Down Expand Up @@ -222,6 +225,9 @@ jobs:
steps:
- run: npm install -g npm@7
- show_node_version
- run:
name: Setup Lerna
command: npm install -g lerna
- run:
name: Update local .npmrc file (Windows)
command: echo "//registry.npmjs.org/:_authToken=$env:NPM_TOKEN" >> .npmrc
Expand All @@ -236,6 +242,18 @@ jobs:
name: Run auth
shell: bash.exe
command: npm run snyk-auth-windows
- when:
condition: << parameters.package_tests >>
steps:
- run:
name: Run Package unit tests
command: npm run test:packages-unit
- when:
condition: << parameters.package_tests >>
steps:
- run:
name: Run Package acceptance tests
command: npm run test:packages-acceptance
- when:
condition: << parameters.root_tap_tests >>
steps:
Expand Down Expand Up @@ -280,6 +298,9 @@ jobs:
steps:
- run: sudo npm install -g npm@7
- show_node_version
- run:
name: Setup Lerna
command: sudo npm install -g lerna
- update_local_npmrc_linux
- install_deps
- build_ts
Expand All @@ -289,6 +310,18 @@ jobs:
- run:
name: Run auth
command: npm run snyk-auth
- when:
condition: << parameters.package_tests >>
steps:
- run:
name: Run Package unit tests
command: npm run test:packages-unit
- when:
condition: << parameters.package_tests >>
steps:
- run:
name: Run Package acceptance tests
command: npm run test:packages-acceptance
- when:
condition: << parameters.root_tap_tests >>
steps:
Expand Down Expand Up @@ -448,12 +481,13 @@ workflows:
requires:
- Regression Test
- test-windows:
name: Windows, Node 14 - Jest, Acceptance, System tests
name: Windows, Node 14 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '14.15.4'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-windows:
Expand All @@ -464,29 +498,31 @@ workflows:
requires:
- Regression Test
- test-windows:
name: Windows, Node 12 - Jest, Acceptance, System tests
name: Windows, Node 12 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '12.16.2'
node_version: '12.21.0'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-windows:
name: Windows, Node 12 - "Root" tap tests
context: nodejs-install
node_version: '12.16.2'
node_version: '12.21.0'
root_tap_tests: true
requires:
- Regression Test

- test-windows:
name: Windows, Node 10 - Jest, Acceptance, System tests
name: Windows, Node 10 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '10.23.1'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-windows:
Expand All @@ -497,12 +533,13 @@ workflows:
requires:
- Regression Test
- test-linux:
name: Linux, Node 14 - Jest, Acceptance, System tests
name: Linux, Node 14 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '14.15.4'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-linux:
Expand All @@ -512,31 +549,31 @@ workflows:
root_tap_tests: true
requires:
- Regression Test

- test-linux:
name: Linux, Node 12 - Jest, Acceptance, System tests
name: Linux, Node 12 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '12.16.2'
node_version: '12.21.0'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test

- test-linux:
name: Linux, Node 12 - "Root" tap tests
context: nodejs-install
node_version: '12.16.2'
node_version: '12.21.0'
root_tap_tests: true
requires:
- Regression Test
- test-linux:
name: Linux, Node 10 - Jest, Acceptance, System tests
name: Linux, Node 10 - Packages, Jest, Acceptance, System tests
context: nodejs-install
node_version: '10.23.1'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-linux:
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test/fixtures/**/*
test/fixtures/**/*
packages/**/test/fixtures/**/*
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ module.exports = {
testMatch: [
'<rootDir>/test/*.spec.ts',
'<rootDir>\\test\\*.spec.ts', // for Windows
'<rootDir>/packages/**/test/*.spec.ts',
'<rootDir>/packages/**/test/**/*.spec.ts',
'<rootDir>\\packages\\**\\test\\*.spec.ts', // for Windows
'<rootDir>\\packages\\**\\test\\**\\*.spec.ts', // for Windows
],
modulePathIgnorePatterns: [
'<rootDir>/test/.*fixtures',
Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@
"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:jest": "jest --runInBand test/*",
"test:packages-unit": "jest packages/**/test/unit/*.spec.ts",
"test:packages-acceptance": "jest packages/**/test/acceptance/*.spec.ts",
"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:test && npm run test:jest",
"test": "npm run test:acceptance && npm run test:system && npm run test:test && npm run test:jest && test:packages-unit && test:packages-acceptance",
"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}'",
Expand Down Expand Up @@ -130,7 +132,7 @@
"devDependencies": {
"@types/agent-base": "^4.2.1",
"@types/diff": "^3.5.2",
"@types/jest": "^25.2.3",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.161",
"@types/needle": "^2.0.4",
"@types/node": "^10.0.0",
Expand All @@ -142,7 +144,7 @@
"@typescript-eslint/parser": "^2.0.0",
"eslint": "6.8.0",
"eslint-config-prettier": "^6.1.0",
"jest": "^25.5.4",
"jest": "^26.6.3",
"lodash": "^4.17.20",
"lodash.countby": "^4.6.0",
"lodash.every": "^4.6.0",
Expand All @@ -156,7 +158,7 @@
"sinon": "^4.0.0",
"tap": "^12.6.1",
"tape": "^4.0.0",
"ts-jest": "^25.5.1",
"ts-jest": "^26.5.2",
"ts-node": "^8.0.0",
"tslint": "^5.14.0",
"typescript": "^3.4.1"
Expand Down
1 change: 1 addition & 0 deletions packages/snyk-protect/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/fixtures/**/*
12 changes: 12 additions & 0 deletions packages/snyk-protect/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {}, // ignore .babelrc file
collectCoverage: false, // not collecting coverage for now
collectCoverageFrom: ['src/**/*.ts'],
coverageReporters: ['text-summary', 'html'],
testMatch: [
'<rootDir>/test/**/*.spec.ts',
'<rootDir>\\test\\**\\*.spec.ts', // for Windows
]
};
6 changes: 5 additions & 1 deletion packages/snyk-protect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
"node": ">=8"
},
"scripts": {
"build": "tsc"
"build": "tsc",
"test": "npm run test:unit && npm run test:acceptance",
"test:unit": "jest test/unit/*.spec.ts",
"test:acceptance": "jest test/acceptance/*.spec.ts",
"format": "prettier --write '{src,test,scripts}/**/*.{js,ts}'"
},
"keywords": [
"security",
Expand Down
Loading

0 comments on commit ebb8dd7

Please sign in to comment.