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

New mochify #395

Merged
merged 4 commits into from Dec 29, 2023
Merged

New mochify #395

merged 4 commits into from Dec 29, 2023

Conversation

mantoni
Copy link
Member

@mantoni mantoni commented Sep 4, 2021

Purpose (TL;DR) - mandatory

I'm working on a rewrite of mochify which aims to solve #380, is more modular and works with any bundler.

Background (Problem in detail) - optional

The current mochify implementation is dated and does not support the latest webdriver protocols.

Solution - optional

The new mochify implementation works with pluggable drivers. The @mochify/driver-webdriver uses the official webdriver module internally.

Interestingly, this successfully runs tests in Safari (although there are failing tests), but I'm having trouble running tests in Firefox and Edge.

New Mochify development happens on the rewrite branch here: https://github.com/mantoni/mochify.js/tree/rewrite

@codecov
Copy link

codecov bot commented Sep 6, 2021

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0f28610) 96.49% compared to head (52bd3df) 97.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #395      +/-   ##
==========================================
+ Coverage   96.49%   97.50%   +1.00%     
==========================================
  Files           2       16      +14     
  Lines         684     3960    +3276     
==========================================
+ Hits          660     3861    +3201     
- Misses         24       99      +75     
Flag Coverage Δ
unit 97.50% <100.00%> (+1.00%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fatso83
Copy link
Contributor

fatso83 commented Sep 6, 2021

Only thing that is failing is the missing Chromium:

Run export SINON_CHROME_BIN=$(which google-chrome-stable)

> @sinonjs/fake-timers@7.1.2 test-headless
> mochify --driver puppeteer "--chrome" "/usr/bin/google-chrome-stable" "--allow-chrome-as-root"

Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (901912).

@mantoni mantoni force-pushed the new-mochify branch 2 times, most recently from 537c0e0 to 52f12e8 Compare September 8, 2021 16:13
@mantoni mantoni marked this pull request as ready for review September 8, 2021 16:18
@mantoni
Copy link
Member Author

mantoni commented Sep 8, 2021

Builds now pass, except for Safari which has failing unit tests.

fatso83 added a commit that referenced this pull request Sep 24, 2021
@fatso83
Copy link
Contributor

fatso83 commented Sep 24, 2021

Any idea what the "kl" in the output is? Some debugging statement left in?

> @sinonjs/fake-timers@8.0.0 test-headless /Users/carlerik/dev/fake-timers
> mochify --driver puppeteer

kl

  .................................,,,,,,,,,,,,,,,.........................................................................................................
  .............................................,...,...........,...........................,,...................................,..............,......,,,,,
  ,,,,,,...,,,,,,,,,,,,,,,,,..........,..,,........,,..

  304 passing (5s)
  55 pending

@mantoni
Copy link
Member Author

mantoni commented Sep 26, 2021

Any idea what the "kl" in the output is?

When I run it locally with the current state of mochify linked locally, this doesn't appear.

@fatso83
Copy link
Contributor

fatso83 commented Sep 26, 2021

Hah, probably me that has fiddled around with node_modules when debugging at some earlier stage and forgot 😄

@fatso83
Copy link
Contributor

fatso83 commented Sep 26, 2021

Just wondering about the tests that fail in Safari ... how do I run these Mochify tests locally against a local Safari instance?

@mantoni
Copy link
Member Author

mantoni commented Sep 26, 2021

You can launch safaridriver locally. It ships with Safari.

Setup and config examples are documented here: https://github.com/mantoni/mochify.js/blob/rewrite/driver-webdriver/README.md

@mantoni
Copy link
Member Author

mantoni commented Dec 24, 2023

I finally manager to get a new Mochify release out and updated this PR.

I have no idea why the selenium job is skipped. Anyone?

Happy Christmas 🎄

@mantoni
Copy link
Member Author

mantoni commented Dec 28, 2023

After a small adjustment, tests now also pass in all browsers, including Safari. Unfortunately Safari does not include the function name in the err.stack, so I had to make some assertions less specific.

While testing I also removed Browserify and used ESBuild instead. If this is not wanted, I'm happy to switch it back.

Copy link
Member

@mroderick mroderick left a comment

Choose a reason for hiding this comment

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

Very nice 👍

@SimenB SimenB linked an issue Dec 29, 2023 that may be closed by this pull request
@SimenB SimenB merged commit 7d6fbcb into main Dec 29, 2023
11 checks passed
@SimenB SimenB deleted the new-mochify branch December 29, 2023 15:50
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.

Safari test run breaks in Sauce Lab due to missing W3C WebDriver support
4 participants