-
Notifications
You must be signed in to change notification settings - Fork 1k
fix: Resolve Web Core CI failures (workflow, tests, and linting) #1001
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -107,8 +107,8 @@ describe('InferredComponentApiSchemaType', () => { | |||||||||
| name: 'MockComp', | ||||||||||
| schema: mockSchema, | ||||||||||
| } satisfies ComponentApi; | ||||||||||
| // Appease typescript-eslint/no-unused-vars | ||||||||||
| type _ = typeof mockApi; | ||||||||||
|
|
||||||||||
| assert.ok(mockApi); | ||||||||||
|
|
||||||||||
| // Type-level equivalence assertion using z.infer | ||||||||||
| type ExpectedType = z.infer<typeof mockSchema>; | ||||||||||
|
|
@@ -120,6 +120,7 @@ describe('InferredComponentApiSchemaType', () => { | |||||||||
| // This happens when `mockApi: ComponentApi`, but doesn't when | ||||||||||
| // `mockApi {} satisfies ComponentApi`! | ||||||||||
| const inferredIsAny: IsAny<InferredType> = false; | ||||||||||
| assert.strictEqual(inferredIsAny, false); | ||||||||||
|
Comment on lines
122
to
+123
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While adding an assertion is a valid way to address the An alternative and often clearer approach for such type-level tests is to use an ESLint disable comment. This explicitly communicates the intent without adding boilerplate runtime code. This same feedback applies to the Consider this alternative:
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no need for these assertions, if the inference was broken, assigning to "false" on line 122 wouldn't compile, I think!
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ahhh I see, that makes sense. Let's add the eslint disable comment instead. |
||||||||||
|
|
||||||||||
| // When types are not "any", check that they're the same by checking if they | ||||||||||
| // extend each other. | ||||||||||
|
|
@@ -132,5 +133,6 @@ describe('InferredComponentApiSchemaType', () => { | |||||||||
| // typesMatchExact only accepts "true" if `TypesAreEquivalent` | ||||||||||
| const typesMatchExact: TypesAreEquivalent<ExpectedType, InferredType> = | ||||||||||
| true; | ||||||||||
| assert.strictEqual(typesMatchExact, true); | ||||||||||
| }); | ||||||||||
| }); | ||||||||||
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.
This change relies on shell glob expansion to find test files, which is not cross-platform. While this will work on Unix-like shells (Linux, macOS), it will likely fail on Windows
cmd.exebecause it does not expand wildcard (*) characters in command arguments. Thenodeexecutable would receive the unexpanded string literal.Additionally, the test paths are hardcoded and duplicated in the
test:coveragescript (line 67), creating a maintenance burden.For a robust and cross-platform solution, consider using a helper package like
globto programmatically find the test files and pass them tonode --test. This would ensure the test command works consistently across all developer environments.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.
Wow, weren't these tests working before?
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.
Nup! I can't believe it either!
Yes, let's try the glob approach - that sounds better.
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.
hmmm...I have no trouble running all the tests by simply running
locally, no globbing patterns required. Do we need to do this?
distseems like a sufficient target and should work on windows.