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

Revert of Revert "test(ssr-tests): print SSR Logs for errors in SSR tests, ALSO when a test times out (#19302) #19326

Merged
merged 5 commits into from
Oct 3, 2024

Conversation

Platonn
Copy link
Contributor

@Platonn Platonn commented Oct 3, 2024

Original PR: #19302
Revert of original PR: #19319 becasue of errors on the develop's pipeline https://github.com/SAP/spartacus/actions/runs/11142085195/job/30964328791

Now bringing back the contents of the original PR, but with ensuring SSR Tests don't encounter the following error again on the pipeline:

node:internal/event_target:1099
  process.nextTick(() => { throw err; });
                           ^
Error: Unknown worker message type message
This is caused by either a bug in Node.js or incorrect usage of Node.js internals.
Please open an issue with this stack trace at https://github.com/nodejs/node/issues
    at Function.fail (node:internal/assert:20:9)
    at Worker.[kOnMessage] (node:internal/worker:354:12)
    at MessagePort.<anonymous> (node:internal/worker:232:57)
    at _ZoneDelegate.Object.<anonymous>._ZoneDelegate.invokeTask (/<project>/node_modules/zone.js/bundles/zone.umd.js:445:35)
    (... rest of stacktrace ...)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
  code: 'ERR_INTERNAL_ASSERTION'

How fixed the problem:
Removed jest-preset-angular from the Jest setup of SSR Tests. Used simply ts-jest instead.

Why it helped
I only deduce that the new custom testEvironment introduced in the Original PR that extends from NodeEnvironment from jest-environment-node conflicted with the jest-preset-angular which under the hood assumes simulating Browser environment (not Node).

Why we really don't need or want jest-preset-angular in SSR Tests project

Note: Finally I could reproduce it on local too, while using JS testEnvironment file instead of TS. Moreover, I could reproduce it only on the first run of tests on local. On the second run, everything would pass. Only when I renamed the file with testEvironment, on the first run of tests, the error could be reproduced again.

related to https://jira.tools.sap/browse/CXSPA-8564

Copy link
Contributor

github-actions bot commented Oct 3, 2024

Merge Checks Failed

Please push a commit to re-trigger the build. 
To push an empty commit you can use `git commit --allow-empty -m "Trigger Build"`

@github-actions github-actions bot marked this pull request as draft October 3, 2024 09:30
@Platonn Platonn marked this pull request as ready for review October 3, 2024 09:31
@Platonn
Copy link
Contributor Author

Platonn commented Oct 3, 2024

SSR Tests passed on the pipeline (I've run it manually, because it deliberately doesn't run on every PR)
See https://github.com/SAP/spartacus/actions/runs/11159409151/job/31017762912#step:7:50

Copy link

cypress bot commented Oct 3, 2024

spartacus    Run #45115

Run Properties:  status check passed Passed #45115  •  git commit 99249e68d9 ℹ️: Merge 98db202ed0c900e39dd75507fd65e612660a0138 into bc29bb55a496410e282a048374f8...
Project spartacus
Branch Review feature/CXSPA-8564-v4
Run status status check passed Passed #45115
Run duration 11m 33s
Commit git commit 99249e68d9 ℹ️: Merge 98db202ed0c900e39dd75507fd65e612660a0138 into bc29bb55a496410e282a048374f8...
Committer Krzysztof Platis
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 3
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 125
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@github-actions github-actions bot marked this pull request as draft October 3, 2024 10:19
@Platonn Platonn marked this pull request as ready for review October 3, 2024 10:28
Copy link
Contributor

@pawelfras pawelfras left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

cypress bot commented Oct 3, 2024

spartacus    Run #45112

Run Properties:  status check passed Passed #45112  •  git commit bfa34c2ddb: chore: don't use `jest-preset-angular` (which conflicts with a custom NodeEnviro...
Project spartacus
Branch Review feature/CXSPA-8564-v4
Run status status check passed Passed #45112
Run duration 54m 00s
Commit git commit bfa34c2ddb: chore: don't use `jest-preset-angular` (which conflicts with a custom NodeEnviro...
Committer Krzysztof Platis
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 22
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 805
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@Platonn Platonn merged commit ce5047c into develop Oct 3, 2024
45 of 47 checks passed
@Platonn Platonn deleted the feature/CXSPA-8564-v4 branch October 3, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants