Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use npm ci when running JS tests #30567

Merged
merged 3 commits into from
Jan 10, 2022
Merged

Conversation

PVince81
Copy link
Member

This makes sure that the pinned versions are selected correctly.
Fixes the colors.js incident.

This should make CI for JS tests work again.

This makes sure that the pinned versions are selected correctly.
Fixes the colors.js incident.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81 PVince81 self-assigned this Jan 10, 2022
@PVince81 PVince81 added bug 3. to review Waiting for reviews labels Jan 10, 2022
@PVince81
Copy link
Member Author

interesting... so the colors.js issue has disappeared, but now the errors on CI match what I always see locally.
I never understood how the tests could even pass on CI if they don't locally, probably an env discrepancy

so at least now the envs are aligned (at least for mine), so it looks like those issues will need solving also

@CarlSchwan
Copy link
Member

interesting... so the colors.js issue has disappeared, but now the errors on CI match what I always see locally. I never understood how the tests could even pass on CI if they don't locally, probably an env discrepancy

so at least now the envs are aligned (at least for mine), so it looks like those issues will need solving also

We probably should update the dependencies and then pin the colors.js dependenfy to 1.4.0

@PVince81
Copy link
Member Author

@CarlSchwan sounds like a good plan, I'll try that. Thanks

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81
Copy link
Member Author

I ran npm install with the pinned dep for colors and pushed the updated package-lock.json.
The same test errors still happen.

@PVince81
Copy link
Member Author

PVince81 commented Jan 10, 2022

I saw that recently more stuff got bundled into the JS files, even stuff that isn't supposed to auto-load during test runs. Causes some XHR to be done too early. Something to examine later.

I had a look at the contacts menu failure where 1 call to console.error is expected instead of 3.
The calls all look like this:

LOG LOG: '##### call 0: [Vue warn]: Cannot find element: #files-app-settings'
LOG LOG: '##### call 1: [Vue warn]: Cannot find element: #app-sidebar'
LOG LOG: '##### call 2: There was an error loading your contacts,[object Object]'

so possibly it's those additional bundles that get loaded that cause more side effects

Prevent XHR during load by checking window.TESTING.
Adjust some expected values.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
@PVince81
Copy link
Member Author

fixed the tests, they pass locally with Chromium and Firefox

@PVince81
Copy link
Member Author

JSUnit passed! 🎉

@PVince81
Copy link
Member Author

I've re-requested a review due to the changes being bigger.
Please have another look, thanks!

Copy link
Contributor

@artonge artonge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One step closer to making them work with npm 7 !

@PVince81 PVince81 added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Jan 10, 2022
@PVince81
Copy link
Member Author

/backport to stable23

@PVince81
Copy link
Member Author

/backport to stable22

@PVince81
Copy link
Member Author

/backport to stable21

@PVince81
Copy link
Member Author

(I'm sure there will be backport conflicts, am already bracing for them...)

@artonge
Copy link
Contributor

artonge commented Jan 10, 2022

(I'm sure there will be backport conflicts, am already bracing for them...)

Maybe put build files into a separate commits so it eases backports

@PVince81 PVince81 merged commit 8954e51 into master Jan 10, 2022
@PVince81 PVince81 deleted the bugfix/noid/npm-ci-for-karma branch January 10, 2022 15:41
@PVince81
Copy link
Member Author

(I'm sure there will be backport conflicts, am already bracing for them...)

Maybe put build files into a separate commits so it eases backports

ah, too late. in any case, I expect conflicts on package-lock perhaps

@backportbot-nextcloud
Copy link

The backport to stable23 failed. Please do this backport manually.

@backportbot-nextcloud
Copy link

The backport to stable22 failed. Please do this backport manually.

@backportbot-nextcloud
Copy link

The backport to stable21 failed. Please do this backport manually.

@PVince81
Copy link
Member Author

PVince81 commented Jan 10, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants