Skip to content

Commit b58f6c4

Browse files
authored
internal: Uncap test workers in CI (#3510)
1 parent bdb427a commit b58f6c4

File tree

14 files changed

+934
-242
lines changed

14 files changed

+934
-242
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ jobs:
118118
name: Running Jest
119119
command: |
120120
if [ "<< parameters.react-version >>" == "^17" ]; then
121-
yarn test:ci --maxWorkers=3 --selectProjects ReactDOM --testPathPatterns packages/react packages/use-enhanced-reducer packages/img
121+
yarn test:ci --selectProjects ReactDOM --testPathPatterns packages/react packages/use-enhanced-reducer packages/img
122122
elif [ "<< parameters.react-version >>" == "^18" ]; then
123-
yarn test:ci --maxWorkers=4 --selectProjects ReactDOM --testPathPatterns packages/react packages/use-enhanced-reducer packages/img
123+
yarn test:ci --selectProjects ReactDOM --testPathPatterns packages/react packages/use-enhanced-reducer packages/img
124124
elif [ "<< parameters.react-version >>" == "native" ]; then
125-
yarn test:ci --maxWorkers=4 --selectProjects ReactNative
125+
yarn test:ci --selectProjects ReactNative
126126
else
127127
curl -Os https://uploader.codecov.io/latest/linux/codecov;
128128
chmod +x codecov;
129-
yarn run test:coverage --ci --maxWorkers=3 --selectProjects ReactDOM Node --coverageReporters=text-lcov > ./lcov.info;
129+
yarn run test:coverage --ci --selectProjects ReactDOM Node --coverageReporters=text-lcov > ./lcov.info;
130130
if [ "$CODECOV_TOKEN" != "" ]; then
131131
./codecov -t ${CODECOV_TOKEN} < ./lcov.info || true;
132132
else

packages/core/src/manager/__tests__/pollingSubscription.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,8 @@ describe('PollingSubscription', () => {
394394
});
395395

396396
it('should not run when timeoutId is deleted after coming online', () => {
397+
// Silence console.warn for this test
398+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
397399
const listener = new MockConnectionListener(false);
398400
const { dispatch, pollingSubscription } = createMocks(listener);
399401
expect(dispatch.mock.calls.length).toBe(0);
@@ -406,6 +408,8 @@ describe('PollingSubscription', () => {
406408
expect(dispatch.mock.calls.length).toBe(0);
407409
expect(listener.offlineHandlers.length).toBe(1);
408410
expect(listener.onlineHandlers.length).toBe(0);
411+
expect(warnSpy.mock.calls.length).toBe(1);
412+
warnSpy.mockRestore();
409413
});
410414

411415
it('should stop dispatching when offline again', () => {

packages/endpoint/src/schemas/__tests__/All.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import { fromJSState } from './denormalize';
1818
let dateSpy: jest.Spied<typeof Date.now>;
1919
beforeAll(() => {
2020
dateSpy = jest
21-
2221
.spyOn(global.Date, 'now')
2322
.mockImplementation(() => new Date('2019-05-14T11:01:58.135Z').valueOf());
2423
});
@@ -65,6 +64,7 @@ describe.each([[]])(`${schema.All.name} normalization (%s)`, () => {
6564
});
6665

6766
test('normalizes multiple entities', () => {
67+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
6868
const inferSchemaFn = jest.fn(input => input.type || 'dogs');
6969
class Person extends IDEntity {}
7070
const listSchema = new schema.All(
@@ -84,6 +84,8 @@ describe.each([[]])(`${schema.All.name} normalization (%s)`, () => {
8484
expect(result).toBeUndefined();
8585
expect(entities).toMatchSnapshot();
8686
expect(inferSchemaFn.mock.calls).toMatchSnapshot();
87+
expect(warnSpy.mock.calls).toMatchSnapshot();
88+
warnSpy.mockRestore();
8789
});
8890

8991
test('normalizes Objects using their values', () => {

packages/endpoint/src/schemas/__tests__/Array.test.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ describe.each([
9494

9595
describe('Class', () => {
9696
class Cats extends IDEntity {}
97+
class Dogs extends IDEntity {}
9798
test('normalizes a single entity', () => {
9899
const listSchema = createSchema(Cats);
99100
expect(
@@ -108,6 +109,7 @@ describe.each([
108109
{
109110
Cat: Cats,
110111
people: Person,
112+
dogs: Dogs,
111113
},
112114
inferSchemaFn,
113115
);
@@ -123,6 +125,31 @@ describe.each([
123125
expect(inferSchemaFn.mock.calls).toMatchSnapshot();
124126
});
125127

128+
test('normalizes multiple entities warning when type is not found', () => {
129+
const warnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
130+
const inferSchemaFn = jest.fn(input => input.type || 'dogs');
131+
class Person extends IDEntity {}
132+
const listSchema = new schema.Array(
133+
{
134+
Cat: Cats,
135+
people: Person,
136+
},
137+
inferSchemaFn,
138+
);
139+
140+
expect(
141+
normalize(listSchema, [
142+
{ type: 'Cat', id: '123' },
143+
{ type: 'people', id: '123' },
144+
{ type: 'not found', id: '789' },
145+
{ type: 'Cat', id: '456' },
146+
]),
147+
).toMatchSnapshot();
148+
expect(inferSchemaFn.mock.calls).toMatchSnapshot();
149+
expect(warnSpy.mock.calls).toMatchSnapshot();
150+
warnSpy.mockRestore();
151+
});
152+
126153
test('normalizes Objects using their values', () => {
127154
class User extends IDEntity {}
128155
const users = createSchema(User);

packages/endpoint/src/schemas/__tests__/__snapshots__/All.test.ts.snap

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Jest Snapshot v1, https://goo.gl/fbAQLP
1+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
22

33
exports[`AllSchema normalization (%s) Class filters out undefined and null normalized values 1`] = `
44
{
@@ -262,6 +262,20 @@ exports[`AllSchema normalization (%s) Class normalizes multiple entities 2`] = `
262262
]
263263
`;
264264

265+
exports[`AllSchema normalization (%s) Class normalizes multiple entities 3`] = `
266+
[
267+
[
268+
"Schema attribute "dogs" is not expected.
269+
Expected one of: "Cat", "people"
270+
271+
Value: {
272+
"id": "789",
273+
"name": "fido"
274+
}",
275+
],
276+
]
277+
`;
278+
265279
exports[`AllSchema normalization (%s) normalizes Objects using their values 1`] = `
266280
{
267281
"User": {

0 commit comments

Comments
 (0)