-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
chore(web): updates chai, @types/chai dependencies 🏃 #11318
Conversation
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
39041ad
to
34cdbb7
Compare
Updates 'chai' assertion library to latest; old version used CommonJS imports
chore(web): missed leaving these out of the rebase
The upgrade to chai means that karma's 'framework' feature is no longer compatible, meaning a _little_ extra legwork is required to use it for karma browser tests. It's just a little bit, though. Will need to replicate this for the other packages that use karma to test, as the pattern kinda proliferated.
34cdbb7
to
3989298
Compare
@@ -36,7 +36,13 @@ describe('ldml keyboard xml reader tests', function () { | |||
callback: (data, source, subpath, callbacks) => { | |||
assert.ok(source?.keyboard3?.keys); | |||
const k = pluckKeysFromKeybag(source?.keyboard3?.keys.key, ['a', 'b', 'c']); | |||
assert.sameDeepOrderedMembers(k, [ | |||
assert.sameDeepOrderedMembers(k.map((entry) => { | |||
// Drop the Symbol members from the returned keys; assertions may expect their presence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Chai version update caused the corresponding unit tests to fail; the "actual" objects from pluckKeysFromKeybag
have Symbol.___
members, while the "expected" ones specified below do not.
In the previous Chai version, Symbol.___
members were not checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoa, noticed something really weird about the last Web test run... https://build.palaso.org/buildConfiguration/Keymanweb_TestPullRequests/460863
Somehow, the script kept going after the Edit: this script was unadjusted by the recent #11329 and has its |
bs_safari_mac_m: { | ||
browser: 'safari', | ||
browser_version: '15.3', | ||
browser_version: '17.3', | ||
os: 'OS X', | ||
os_version: 'Monterey' | ||
os_version: 'Sonoma' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems as though the version of Safari we'd been targeting for testing with BrowserStack didn't like the updated Chai assertion library. There were a number of build failures that mentioned test-loading issues in a manner kind of buried inside the build logs; I'd missed that detail for several builds. Updating the target to a more recent Safari version bypasses the issue.
Our goal with the 🏃 PR series is migrate away from CI testing against BrowserStack anyway, so I consider this a "stopgap" measure we can use to keep the tests passing during the test-migration process.
That's because the build configuration step masks it:
Batch files do not exit automatically on failure. You need something like this after each node call:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of the deep references into node_modules but I guess there isn't a really nice way around that at present?
However, what if we had a stub module called /common/web/test/chai.js which just exported from node_modules:
export { assert, expect } from '../../../../../../../.../../././..,,.,/./.../node_modules/chai/chai.js';
Fortunately, once we convert tests to the new format, all those deep-references disappear. We need them for What you've suggested here is likely a "decent enough" workaround, and would probably be enough if you do want me to go ahead and make the transitional form cleaner. See #11404 (comment) as a reference for how it gets fixed upon migration. |
This is good enough for me. No point in doing extra maintenance on an issue that's about to be resolved anyway. |
Changes in this pull request will be available for download in Keyman version 18.0.36-alpha |
One major task I identified while working on #11300 (toward resolving #10497) is that we'll need to update our JS testing-assertion library. Chai 4 exists as a CommonJS module, but the modern tools we're looking to migrate toward require ES Module libraries. The Chai team fixed this with version 5, so we may as well update.
This PR's changeset has been directly extracted from an intermediate state of #11300.
This has a few "fun" knock-on effects for our Karma tests; the "framework" loading approach we previously used is not viable with it, as it is not ES-module aware. With a little legwork, we can patch everything up and maintain the tests as they are, just using the new Chai version, before we begin migrating the affected tests to a new testing framework.
@keymanapp-test-bot skip