I would like to setup the development environment to contribute to this project. I followed steps in CONTRIBUTING.md which are:
yarn to install packagesyarn build to build the packagesyarn test and with no changes to the original code I am getting 13 failed tests (I assume this is not expected)My env:
node: v14.15.0
npm: 6.14.8
yarn: 1.22.4
What could be a reason for failing tests ? Did I miss any step or configuration?
Side note:
I tried to upgrade to React v17 to help with #872 and I got 88 failed tests 🤔
Looks like tests currently fail locally because @visx/xychart is still marked as private.
The workaround for now is to update monorepo root package.json to:
"collectCoverageFrom": [
"packages/src/**/*.{ts,tsx}",
"!node_modules/**",
"!packages/**/esm/**",
"!packages/**/lib/**",
"!packages/**/node_modules/**",
"!packages/visx-demo/**",
"!packages/visx-visx/**",
+ "!packages/visx-xychart/**"
],
"testPathIgnorePatterns" : [
"<rootDir>/packages/visx-demo",
"<rootDir>/packages/visx-visx" ,
+ "<rootDir>/packages/visx-xychart"
],
cc @williaster - should we commit the above until xychart is no longer private? or maybe there's a better workaround than the above for local development
Thanks for reporting this @m0t0r, sorry about the issues.
I just did a fresh clone + install, and the same sequence worked fine for me (yarn && yarn build && yarn test). I haven't had any issues with the @visx/xychart being private, I believe yarn should manage that fine in the monorepo context, and I'm not sure why CI would be different from a local dev environment except for node/npm/yarn versions.
I'm running some older ones: yarn 1.17.3, node 10.14.3, npm 6.9.0. These are quite a bit behind yours so I can try with an upgrade. In the meantime can you confirm that the failing tests you are seeing are for the xychart package?
I'm happy to commit @hshoff 's fix above for as long as xychart is private if that fixes it 😅 .
Just tested locally on yarn. 1.22.10, npm 6.14.8, and node 14.15.0 and the yarn && yarn build && yarn test sequence still worked for me.
@hshoff sounds like you were able to reproduce this, though?
@williaster yes I was able to reproduce on a fresh clone. maybe xychart is built/cached somewhere on your box? could be that it's not due to the private field at all and it's something else.
Summary of all failing tests
FAIL packages/visx-xychart/test/components/BarStack.test.tsx (137 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
92 |
93 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 94 | expect.assertions(2);
| ^
95 |
96 | const showTooltip = jest.fn();
97 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/BarStack.test.tsx:94:12)
●
expect(received).toHaveLength(expected)
Expected length: 4
Received length: 0
Received object: {}
143 | </DataProvider>,
144 | );
> 145 | expect(wrapper.find(animated.rect)).toHaveLength(4);
| ^
146 | });
147 | });
148 |
at Object.<anonymous> (packages/visx-xychart/test/components/BarStack.test.tsx:145:41)
FAIL packages/visx-xychart/test/components/AreaSeries.test.tsx (215 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
39 |
40 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 41 | expect.assertions(2);
| ^
42 |
43 | const showTooltip = jest.fn();
44 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/AreaSeries.test.tsx:41:12)
●
expect(received).toHaveLength(expected)
Expected length: 1
Received length: 0
Received object: {}
91 | </DataContext.Provider>,
92 | );
> 93 | expect(wrapper.find(animated.path)).toHaveLength(1);
| ^
94 | });
95 | });
96 |
at Object.<anonymous> (packages/visx-xychart/test/components/AreaSeries.test.tsx:93:41)
FAIL packages/visx-xychart/test/components/LineSeries.test.tsx (288 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
27 |
28 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 29 | expect.assertions(2);
| ^
30 |
31 | const showTooltip = jest.fn();
32 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/LineSeries.test.tsx:29:12)
●
expect(received).toHaveLength(expected)
Expected length: 1
Received length: 0
Received object: {}
79 | </DataContext.Provider>,
80 | );
> 81 | expect(wrapper.find(animated.path)).toHaveLength(1);
| ^
82 | });
83 | });
84 |
at Object.<anonymous> (packages/visx-xychart/test/components/LineSeries.test.tsx:81:41)
FAIL packages/visx-xychart/test/components/BarSeries.test.tsx (142 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
25 |
26 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 27 | expect.assertions(2);
| ^
28 |
29 | const showTooltip = jest.fn();
30 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/BarSeries.test.tsx:27:12)
●
expect(received).toHaveLength(expected)
Expected length: 2
Received length: 0
Received object: {}
77 | </DataContext.Provider>,
78 | );
> 79 | expect(wrapper.find(animated.rect)).toHaveLength(series.data.length);
| ^
80 | });
81 | });
82 |
at Object.<anonymous> (packages/visx-xychart/test/components/BarSeries.test.tsx:79:41)
FAIL packages/visx-xychart/test/components/GlyphSeries.test.tsx (214 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
37 |
38 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 39 | expect.assertions(2);
| ^
40 |
41 | const showTooltip = jest.fn();
42 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/GlyphSeries.test.tsx:39:12)
●
expect(received).toHaveLength(expected)
Expected length: 2
Received length: 0
Received object: {}
89 | </DataContext.Provider>,
90 | );
> 91 | expect(wrapper.find(animated.g)).toHaveLength(series.data.length);
| ^
92 | });
93 | });
94 |
at Object.<anonymous> (packages/visx-xychart/test/components/GlyphSeries.test.tsx:91:38)
FAIL packages/visx-xychart/test/components/BarGroup.test.tsx (284 MB heap size)
●
Error: Uncaught [ReferenceError: HandlerParams is not defined]
24 | tooltipContext?: Partial<TooltipContextType<object>>,
25 | ) {
> 26 | return mount(
| ^
27 | <DataProvider {...providerProps}>
28 | <EventEmitterProvider>
29 | <TooltipContext.Provider value={{ ...defaultTooltipContext, ...tooltipContext }}>
●
expect.assertions(2)
Expected two assertions to be called but received zero assertion calls.
54 |
55 | it('should invoke showTooltip/hideTooltip on mousemove/mouseout', () => {
> 56 | expect.assertions(2);
| ^
57 |
58 | const showTooltip = jest.fn();
59 | const hideTooltip = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/components/BarGroup.test.tsx:56:12)
●
expect(received).toHaveLength(expected)
Expected length: 4
Received length: 0
Received object: {}
105 | </DataProvider>,
106 | );
> 107 | expect(wrapper.find(animated.rect)).toHaveLength(4);
| ^
108 | });
109 | });
110 |
at Object.<anonymous> (packages/visx-xychart/test/components/BarGroup.test.tsx:107:41)
FAIL packages/visx-xychart/test/hooks/useEventEmitter.test.tsx (350 MB heap size)
● useEventEmitter › should register event listeners and emit events
Error: Uncaught [ReferenceError: HandlerParams is not defined]
43 | };
44 |
> 45 | mount(
| ^
46 | <EventEmitterProvider>
47 | <Component />
48 | </EventEmitterProvider>,
● useEventEmitter › should register event listeners and emit events
expect.assertions(1)
Expected one assertion to be called but received zero assertion calls.
26 |
27 | it('should register event listeners and emit events', () => {
> 28 | expect.assertions(1);
| ^
29 |
30 | const Component = () => {
31 | const listener = jest.fn();
at Object.<anonymous> (packages/visx-xychart/test/hooks/useEventEmitter.test.tsx:28:12)
Test Suites: 7 failed, 161 passed, 168 total
Tests: 13 failed, 878 passed, 891 total
@williaster I have exactly same failing visx-xychart tests as @hshoff. Proposed fix resolves all issues.