Skip to content

Commit

Permalink
chore: run tests in packages in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
maxjeffos committed Feb 26, 2021
1 parent 3e7e99e commit 4848b7e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
53 changes: 45 additions & 8 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,12 +498,13 @@ 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'
jest_tests: true
acceptance_tests: true
system_tests: true
package_tests: true
requires:
- Regression Test
- test-windows:
Expand All @@ -481,12 +516,13 @@ workflows:
- 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,17 +549,16 @@ 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'
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
Expand All @@ -531,12 +567,13 @@ workflows:
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
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
6 changes: 4 additions & 2 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 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

0 comments on commit 4848b7e

Please sign in to comment.