Skip to content

Update service to ESM and WDIO v9#126

Merged
christian-bromann merged 59 commits intowebdriverio-community:mainfrom
dons20:ESM-update
Nov 24, 2025
Merged

Update service to ESM and WDIO v9#126
christian-bromann merged 59 commits intowebdriverio-community:mainfrom
dons20:ESM-update

Conversation

@dons20
Copy link
Copy Markdown
Contributor

@dons20 dons20 commented Oct 31, 2023

Description

This started as a small experiment to make some changes locally to update the service. I figured it may be a good idea to update this to use ESM as well as Node v20 since it's the latest LTS at this time.

Leaving this up as a draft to get some initial thoughts. I'm not particularly opinionated as to the direction this should go either. Will need to do additional testing so that everything is compatible, but hopefully some of these changes help 🙂

Checklist

  • Unit/Integration test added (if applicable)
  • Documentation added/updated (wiki or md)
  • Code style is consistent with the rest of the project

Keno added 2 commits October 30, 2023 00:45
Updated to WDIO v8
Updated to Node v18
Switch to jsconfig for now
Updated necessary types for spec files
Specify browserVersion for wdio conf
Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread src/launcher.js Outdated
Comment thread test/unit/modules/dockerEventsSpec.js Outdated
Comment thread src/utils/dockerEventsListener.js Outdated
Replaced import all with default import
Removed unnecessary export
@christian-bromann
Copy link
Copy Markdown
Collaborator

@dons20 thanks for taking a stab at it. Happy to help if needed.

@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Nov 20, 2023

Haven't forgotten about this one, I had some major PC issues. SSD failed but I got it replaced. Will have some changes out soon again.

Removed older babel references, configs
Added types in place of JSDoc types
Update files to correct line-endings
@christian-bromann
Copy link
Copy Markdown
Collaborator

Hey @dons20 , thanks for all your work so far! Let me know when you think this is ready for review!

@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Dec 20, 2023

Will do, I only have to retest the test directory with these new changes. Everything else should be done

Updated deps
Added temporary file for further run arg types and comments
@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Jan 22, 2024

Back at it, pushed some of my changes, and I'll have some more incoming soon. Trying to get the local build and tests working fully.

@christian-bromann
Copy link
Copy Markdown
Collaborator

Awesome, looking forward to the changes. Let me know when I can review something.

dons20 and others added 3 commits January 22, 2024 22:34
Added mocks where needed
Updated tsconfigs to handle build vs development type-checking
Updated imports where applicable
Other minor improvements
Updated more configs
Added some dev dependencies
@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Jan 24, 2024

I'm pretty happy with the results so far, and I think most of this can start to be reviewed, but you can let me know if I should take this out of draft yet. I still have these items on my todo list:

  • Fixing failing unit tests and verify coverage is displaying correctly
  • Fixing WDIO config so that it connects in its integration tests
  • Updating CJS directory to output the necessary cjs module (I took inspiration from some other services which implemented this such as wdio-nuxt-service)
  • Verifying output from build

Copy link
Copy Markdown
Collaborator

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Some comments, overall looks aweseome!

Comment thread .nvmrc Outdated
Comment thread .travis.yml Outdated
Comment thread README.md Outdated
Comment thread src/index.ts Outdated
Comment thread src/launcher.ts Outdated
Comment thread src/launcher.ts Outdated
Comment thread src/launcher.ts Outdated
Comment thread src/launcher.ts
}
}

class DockerLauncherForTests extends DockerLauncher {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why is this needed, seems like DockerLauncher defines this props to be public

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When writing the tests, it complained about some variables being private or protected when trying to stub or spy. Perhaps there's a better way of resolving this?

Comment thread src/utils/docker.ts
Comment thread src/utils/ping.ts Outdated
@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Jan 24, 2024

Thanks for reviewing! Will go through the comments shortly

@christian-bromann
Copy link
Copy Markdown
Collaborator

@dons20 any updates or anything I can help with?

@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Feb 27, 2024

No updates yet, had a couple of busy weeks but I will make some updates in the coming days 🤞🏾

@seanpoulter seanpoulter mentioned this pull request Mar 5, 2024
3 tasks
@seanpoulter
Copy link
Copy Markdown
Contributor

Would it help if I separated out the upgrade from v7 to v8 to fix the CI pipeline added in #132?

@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Mar 7, 2024

@seanpoulter If that is something you can manage in a short period of time, then feel free to

@dons20
Copy link
Copy Markdown
Contributor Author

dons20 commented Nov 23, 2025

Okay so after a few hours of troubleshooting the pipeline, I was able to identify a few necessary fixes to the code itself. Here's what I identified and fixed.

  1. The pipeline would hang at the end of the test step. This was fixed with a call to process.unref() so that Node could move on with the remaining steps.
  2. After pulling a fresh image, the container wouldn't automatically startup, so the health checks to the URL would never work. Fixed by changing return to await in await this._pullImage(). I identified that if I added a step before the tests to simply pre-fetch the image I wanted to run in the test, the test would actually pass 100% of the time. So it was simply an issue of the image being fetched but not started when needed.
  3. Health check polling logic was a bit incorrect in terms of when it would increment the retry counter, so that was updated, though it may not be critical anymore.
  4. I had to add a workaround for the CI environment so that it would use the loopback IP address 127.0.0.1 instead of host.docker.internal. Note: It might be possible to use the latter on all platforms with another workaround, but I'm exhausted from all the retries 😆 so maybe that's a future improvement.

@christian-bromann you can take a look at the latest changes as well as the pipeline. This should be good to go now.

Copy link
Copy Markdown
Collaborator

@christian-bromann christian-bromann left a comment

Choose a reason for hiding this comment

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

Amazing work 👏 Thanks a ton!

@christian-bromann christian-bromann merged commit 33fdf44 into webdriverio-community:main Nov 24, 2025
1 check passed
@wdio-bot
Copy link
Copy Markdown

Hey dons20 👋

Thank you for your contribution to WebdriverIO! Your pull request has been marked as an "Expensable" contribution.

We've sent you an email with further instructions on how to claim your expenses from our development fund.
Please make sure to check your spam folder as well. If you have any questions, feel free to reach out to us at expense@webdriver.io or in the contributing channel on Discord.

We are looking forward to more contributions from you in the future 🙌

Have a nice day,
The WebdriverIO Team 🤖

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.

5 participants