Skip to content

Commit 6f4e1db

Browse files
authored
chore(common): CHECKOUT-6271 Make changes to circle config (#1798)
1 parent a9baea9 commit 6f4e1db

File tree

9 files changed

+117
-34
lines changed

9 files changed

+117
-34
lines changed

.circleci/config.yml

+48-11
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,37 @@ orbs:
1111
node: bigcommerce/internal-node@volatile
1212

1313
jobs:
14+
test-packages:
15+
<<: *node_executor
16+
steps:
17+
- ci/pre-setup
18+
- node/npm-install
19+
- run:
20+
name: "Run unit tests for packages"
21+
command: npm run test:others
22+
23+
test-core:
24+
<<: *node_executor
25+
parallelism: 2
26+
resource_class: small
27+
steps:
28+
- ci/pre-setup
29+
- node/npm-install
30+
- run: mkdir ~/junit
31+
- run:
32+
name: "Run unit tests for core package"
33+
command: |
34+
TEST=$(circleci tests glob "packages/core/**/*.spec.ts" | circleci tests split --split-by=timings)
35+
npx nx run core:generate
36+
npm test $TEST -- --runInBand
37+
- run:
38+
command: cp junit.xml ~/junit/
39+
when: always
40+
- store_test_results:
41+
path: ~/junit
42+
- store_artifacts:
43+
path: ~/junit
44+
1445
test:
1546
<<: *node_executor
1647
steps:
@@ -19,18 +50,22 @@ jobs:
1950
- run:
2051
name: "Run unit tests"
2152
command: npm run test:series -- --coverage
22-
- store_artifacts:
23-
path: coverage
24-
destination: coverage
25-
26-
build:
53+
54+
lint:
2755
<<: *node_executor
56+
resource_class: medium+
2857
steps:
2958
- ci/pre-setup
3059
- node/npm-install
3160
- run:
32-
name: "Run linter"
61+
name: "Run lint"
3362
command: npm run lint
63+
64+
build:
65+
<<: *node_executor
66+
steps:
67+
- ci/pre-setup
68+
- node/npm-install
3469
- run:
3570
name: "Build distribution files"
3671
command: npm run build && npm run docs
@@ -87,7 +122,9 @@ workflows:
87122

88123
default:
89124
jobs:
90-
- test
125+
- test-core
126+
- test-packages
127+
- lint
91128
- build
92129
- ci/validate-commits
93130

@@ -97,7 +134,9 @@ workflows:
97134
branches:
98135
ignore: /pull\/[0-9]+/
99136
requires:
100-
- test
137+
- test-core
138+
- test-packages
139+
- lint
101140
- build
102141
- ci/validate-commits
103142
- ci/build-js-artifact:
@@ -119,9 +158,7 @@ workflows:
119158
branches:
120159
only: master
121160
requires:
122-
- test
123-
- build
124-
- ci/validate-commits
161+
- ci/notify-success
125162
- npm_release:
126163
requires:
127164
- approve_npm_release

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@
1010
/packages/**/generated
1111
.idea
1212
.vscode
13+
junit.xml

jest.preset.js

+6-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
21
const nxPreset = require('@nrwl/jest/preset');
3-
2+
43
module.exports = {
54
...nxPreset,
65
coverageThreshold: {
@@ -11,18 +10,10 @@ module.exports = {
1110
statements: 80,
1211
},
1312
},
13+
reporters: ['default', 'jest-junit'],
1414
transform: {
15-
'^.+\\.[tj]s$': 'ts-jest'
15+
'^.+\\.[tj]s$': 'ts-jest',
1616
},
17-
moduleFileExtensions: [
18-
'ts',
19-
'tsx',
20-
'js',
21-
'jsx',
22-
'json',
23-
],
24-
collectCoverageFrom: [
25-
'src/**/*.{js,ts}',
26-
'!src/**/*.mock.ts'
27-
],
28-
}
17+
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
18+
collectCoverageFrom: ['src/**/*.{js,ts}', '!src/**/*.mock.ts'],
19+
};

nx.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"build-watch",
1717
"lint",
1818
"test"
19-
]
19+
],
20+
"parallel": 5
2021
}
2122
}
2223
}

package-lock.json

+47
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+10-4
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@
3636
"bundle-dts": "npx nx run core:build-dts",
3737
"docs": "npx nx run core:docs",
3838
"generate": "npx nx run core:generate",
39-
"lint": "npx nx run-many --target=lint --all",
39+
"lint": "npx nx run-many --target=lint --parallel=5 --all --verbose",
4040
"release": "echo 'Please do not release locally, use CircleCi'",
4141
"release:version": "git add dist docs && standard-version -a",
4242
"release:alpha": "export PRERELEASE=alpha; npm run lint && npm test && npm run build && npm run release:version",
43-
"test": "npx nx run-many --all --target=test --parallel",
44-
"test:coverage": "npx nx run-many --all --target=test --parallel -- --coverage",
45-
"test:series": "npx nx run-many --all --target=test --parallel -- --runInBand",
43+
"test": "jest --config packages/core/jest.config.js",
44+
"test:coverage": "npx nx run-many --all --target=test --parallel=5 -- --coverage",
45+
"test:series": "npx nx run-many --all --target=test --parallel=5 -- --runInBand",
46+
"test:core": "npx nx run core:test -- --coverage --runInBand",
47+
"test:others": "npx nx run-many --all --target=test --exclude core --parallel=5 -- --runInBand",
4648
"test:watch": "npx nx run-many --all --target=test --parallel -- --watch"
4749
},
50+
"jest-junit": {
51+
"addFileAttribute": "true"
52+
},
4853
"dependencies": {
4954
"@babel/polyfill": "^7.12.1",
5055
"@bigcommerce/bigpay-client": "^5.22.0",
@@ -104,6 +109,7 @@
104109
"eslint-plugin-react": "^7.30.1",
105110
"eslint-plugin-react-hooks": "^4.6.0",
106111
"jest": "^24.9.0",
112+
"jest-junit": "^15.0.0",
107113
"nx": "^13.10.3",
108114
"prettier": "^2.6.2",
109115
"request": "^2.83.0",

packages/core/jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ module.exports = {
88
},
99
},
1010
setupFilesAfterEnv: ['../../jest-setup.js'],
11-
coverageDirectory: '../../coverage/packages/core'
11+
coverageDirectory: '../../coverage/packages/core',
1212
};

packages/core/project.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@
103103
"outputs": ["coverage/packages/core"],
104104
"options": {
105105
"jestConfig": "packages/core/jest.config.js",
106-
"passWithNoTests": true
106+
"passWithNoTests": true,
107+
"runInBand": true
107108
},
108109
"dependsOn": [
109110
{

packages/core/src/spam-protection/google-recaptcha-script-loader.spec.ts

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ describe('GoogleRecaptchaScriptLoader', () => {
6060
const loadPromise = googleRecaptchaScriptLoader.load();
6161

6262
mockWindow.grecaptcha = getGoogleRecaptchaMock();
63-
// tslint:disable-next-line:no-non-null-assertion
6463
mockWindow.initRecaptcha!();
6564

6665
expect(loadPromise).resolves.toEqual(mockWindow.grecaptcha);

0 commit comments

Comments
 (0)