Skip to content

Conversation

MichaelWest22
Copy link
Collaborator

@MichaelWest22 MichaelWest22 commented Apr 15, 2025

Description

This is a big change to impalement a newer web-test-runner testing framework instead of just mocha that was introduced to idiomorph. It also includes many new tests to test all feature paths that are testable. I was able to get to 100% lines of code testing coverage by reviewing the code coverage report and by removing dead paths like IE fallbacks plus a few tricks to hide what can't be tested. However in this first PR the code coverage is only 99% because I have not included any non test changes yet. Some coverage tests I had to alter or disable to work around code bugs I identified during testing.

  • Updated NPM packages to latest non breaking change versions
  • Installed web-test-runner as the new headless testing framework
  • setup playwright 3 way browser testing on top of web-test-runner
  • upgraded mocha to latest and removed old mocha headless stuff
  • Improved mocha browser test experience with better console logging of test names to get error logs in context with the tests
  • installed mocha eslint plugin to detect mocha test issues and avoid it.only tests being committed
  • loads and loads of new tests to get complete code coverage

Corresponding issue:

Testing

Testing all the things!

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@@ -68,23 +68,6 @@ describe('hx-confirm attribute', function() {
}
})

it('should allow skipping built-in window.confirm when using issueRequest', function() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

identical duplicate test removed here

@@ -354,14 +367,18 @@ describe('Core htmx AJAX headers', function() {
htmx.off('bar', handlerBar)
})

it('should change body content on HX-Location', function() {
this.server.respondWith('GET', '/test', [200, { 'HX-Location': '{"path":"/test2", "target":"#testdiv"}' }, ''])
it.skip('should change body content on HX-Location', function(done) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Found a bug where failed swaps and url's that fail validation cause request lock to remain blocking future requests from the same element which brake this test so we need to fix request locking

ui: "bdd",
rootHooks: {
beforeEach(done) {
console.log(`${this?.currentTest?.parent?.title} - ${this?.currentTest?.title}`)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a custom logging hook here so that console logs are now a lot easier to read and find the test logs and errors

'test/attributes/**/*.js',
'test/core/**/*.js'
],
reporters: [defaultReporter()]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can add summaryReporter() in here as well to dump all test names out as well But I found it doubled up the console/error logs and made it hard to find failed tests in all the spam. Can try with it added to see if you prefer this though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

solved the summaryReporter issue i had with a workaround and made an upstream PR modernweb-dev/web#2932 to possibly resolve it properly later.

@Telroshan
Copy link
Collaborator

Tremendous, amazing work!

@Telroshan Telroshan added the devops Changes to the repository structure or project management label Apr 16, 2025
@1cg
Copy link
Contributor

1cg commented Apr 17, 2025

Tremendous, amazing work!

The understatement of the year!

@1cg 1cg self-assigned this Apr 17, 2025
Copy link
Contributor

@1cg 1cg left a comment

Choose a reason for hiding this comment

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

really, unbelievable stuff, thank you so much

@1cg 1cg merged commit 24a0106 into bigskysoftware:dev Apr 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devops Changes to the repository structure or project management
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants