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

Update service to ESM and WDIO v8 #126

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

dons20
Copy link

@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
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/launcher.js Outdated Show resolved Hide resolved
test/unit/modules/dockerEventsSpec.js Outdated Show resolved Hide resolved
src/utils/dockerEventsListener.js Outdated Show resolved Hide resolved
Replaced import all with default import
Removed unnecessary export
@christian-bromann
Copy link
Collaborator

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

@dons20
Copy link
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
Collaborator

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

@dons20
Copy link
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
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
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
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
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!

.nvmrc Outdated Show resolved Hide resolved
.travis.yml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
src/index.ts Outdated Show resolved Hide resolved
src/launcher.ts Outdated Show resolved Hide resolved
src/launcher.ts Outdated Show resolved Hide resolved
src/launcher.ts Outdated Show resolved Hide resolved
}
}

class DockerLauncherForTests extends DockerLauncher {
Copy link
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
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?

startDelay?: number;
};

export type DockerRunArgs = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there an NPM package that contains these types?

Copy link
Author

Choose a reason for hiding this comment

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

Not that I'm aware of unfortunately. If a good, updated one exists, I'd be happy to migrate to it.

@@ -0,0 +1,9 @@
import fetch from 'node-fetch';

class PingClass {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are your planning to add anything to this class? If not I guess it makes sense to not abstract a single fetch call

Copy link
Author

Choose a reason for hiding this comment

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

This one I'm not particularly opinionated about. It was previously just a regular function export but I migrated it to a class to address a TS issue in Sinon ES Modules cannot be stubbed. I was using one of the suggestions listed here.

Relevant SO threads: One Two

@dons20
Copy link
Author

dons20 commented Jan 24, 2024

Thanks for reviewing! Will go through the comments shortly

@christian-bromann
Copy link
Collaborator

@dons20 any updates or anything I can help with?

@dons20
Copy link
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
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
Author

dons20 commented Mar 7, 2024

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

@seanpoulter
Copy link
Contributor

It's probably no surprise but the update from v7 to v8 requires loading the ES Module @wdio/logger from the CJS code. I don't know how to do that as a concise change. 🤦

Let me know if there's anything else I can do to help.

@dons20
Copy link
Author

dons20 commented Mar 9, 2024

Totally understand. I'm pushing some changes within this weekend, hopefully it will advance this PR much further so it can cover all the concerns.

Keno Clayton added 3 commits March 17, 2024 03:46
More usage of sandbox instead of direct stubs
Removed console log
Fixed some warnings and errors displayed in some test contexts
@dons20
Copy link
Author

dons20 commented Mar 17, 2024

So recently I've been working on the unit tests as they were tricky to get started. After much debugging I had realized that one file was blocking the others from executing. Once I commented some of those tests, the others started running and I was able to fix the failing ones. There are about 20 to resolve on the unit tests side.

I'll continue chipping away at it in the coming days whenever I can find time. Just keeping everyone in the loop.

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.

3 participants