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

Add workaround for the karma test on WSL #2447

Merged
merged 1 commit into from
Jun 4, 2021
Merged

Add workaround for the karma test on WSL #2447

merged 1 commit into from
Jun 4, 2021

Conversation

takahirox
Copy link
Contributor

Reference Issue

Related discussion: #2194

The problem this PR fixes

It doesn't seem that $ num run test:ci runs on WSL2.

$ npm run test:ci

> test:ci
> ./node_modules/.bin/lerna run test:ci --stream

lerna notice cli v3.22.1
lerna info versioning independent
lerna info Executing command in 4 packages: "npm run test:ci"
@google/model-viewer: > @google/[email protected] test:ci
@google/model-viewer: > npm run test
@google/model-viewer: > @google/[email protected] test
@google/model-viewer: > karma start --single-run
@google/model-viewer: (node:13498) [DEP0148] DeprecationWarning: Use of deprecated folder mapping "./dist/" in the "exports" field module resolution of the package at /mnt/c/Users/Takahiro/Documents/model-viewer/packages/model-viewer/node_modules/systemjs/package.json.
@google/model-viewer: Update this package.json to use a subpath pattern like "./dist/*".
@google/model-viewer: (Use `node --trace-deprecation ...` to show where the warning was created)
@google/model-viewer: START:
@google/model-viewer: 01 06 2021 18:12:18.813:INFO [karma-server]: Karma v5.2.3 server started at http://localhost:9876/
@google/model-viewer: 01 06 2021 18:12:18.864:INFO [launcher]: Launching browsers ChromeHeadless with concurrency 10
@google/model-viewer: 01 06 2021 18:12:19.160:INFO [launcher]: Starting browser ChromeHeadless
@google/model-viewer: 01 06 2021 18:19:19.262:WARN [launcher]: ChromeHeadless have not captured in 420000 ms, killing.
@google/model-viewer: 01 06 2021 18:19:19.284:INFO [launcher]: Trying to start ChromeHeadless again (1/2).
@google/model-viewer: 01 06 2021 18:26:19.386:WARN [launcher]: ChromeHeadless have not captured in 420000 ms, killing.
@google/model-viewer: 01 06 2021 18:26:19.389:INFO [launcher]: Trying to start ChromeHeadless again (2/2).
@google/model-viewer: 01 06 2021 18:33:19.489:WARN [launcher]: ChromeHeadless have not captured in 420000 ms, killing.
@google/model-viewer: 01 06 2021 18:33:19.493:ERROR [launcher]: ChromeHeadless failed 2 times (timeout). Giving up.
@google/model-viewer: Finished in 0 secs / 0 secs @ 18:33:19 GMT-0700 (Pacific Daylight Time)
lerna ERR! npm run test:ci exited 1 in '@google/model-viewer'

Platform: Windows10 + WSL2 + Ubuntu 18.04 LTS

It doesn't seem that Headless Chrome boots up correctly.

Solution

This PR fixes the problem by setting the following as workaround in karma.conf.js

    browsers: ['ChromeHeadlessNoSandbox'],
    customLaunchers: {
      ChromeHeadlessNoSandbox: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },

The solution is from karma-runner/karma-chrome-launcher#158 (comment)

With this change $ npm run test:ci runs on my WSL2.

Request

If this change looks ok, just in case would you please check that this change doesn't break the tests on other platforms if you work on Mac, Linux, or others, before you merge this PR?

@ghost
Copy link

ghost commented Jun 2, 2021

Thanks, runs on mac.

@ghost ghost requested a review from elalish June 2, 2021 18:48
Copy link
Contributor

@elalish elalish left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@elalish elalish merged commit 57da3d6 into google:master Jun 4, 2021
@takahirox takahirox deleted the WSLWorkaround branch June 5, 2021 00:51
@takahirox
Copy link
Contributor Author

Hm, test:ci on Mobile Safari 13.0.3 (iOS 13.2) seems to fail...

https://github.com/google/model-viewer/runs/2749649928#step:9:841

@google/model-viewer: FAILED TESTS:
@google/model-viewer:   ModelScene
@google/model-viewer:     setModelSource
@google/model-viewer:       ✖ fires a model-load event when loaded
@google/model-viewer:         Mobile Safari 13.0.3 (iOS 13.2)
@google/model-viewer:       the xmlhttprequestprogressevent {"isTrusted":true} was thrown, throw an Error :)
@google/model-viewer:       promiseReactionJob@[native code]
@google/model-viewer:     with a model
@google/model-viewer:       ✖ "before each" hook for "can increase intensity and reset it to zero"
@google/model-viewer:         Mobile Safari 13.0.3 (iOS 13.2)
@google/model-viewer:       the xmlhttprequestprogressevent {"isTrusted":true} was thrown, throw an Error :)
@google/model-viewer:       promiseReactionJob@[native code]

@elalish
Copy link
Contributor

elalish commented Jun 7, 2021

Unfortunately we have some flaky tests, especially on Mobile Safari. I'm confident it's not your fault.

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