-
Notifications
You must be signed in to change notification settings - Fork 722
test(spanner): adopt runtime-agnostic test runner and Bun compatibility #9460
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
Changes from all commits
e952549
27579a0
93ae259
dc9e502
8088cf4
d208619
756cc45
5a29104
e780546
c9446ab
845f8d7
4f67497
6668550
4c4a74d
895f088
486a301
687e386
1f30b9d
da1602a
b6e6db1
3a88414
8dee1fc
7534a50
f064618
90d9b6e
fa014d2
ec5195e
db68151
da9b310
eeb2881
1ba1deb
ef29c38
4f26692
dc86050
33705f6
c3107be
bc4b3a1
57b55c4
9ee0139
a8c6d61
b03058e
fdc7270
8012918
ae0c6b2
5cecab2
2a8a2d8
d8bdff9
53cf89f
8233cbf
55e9e98
5f9de1c
c8c4d71
71bfe1c
a61d3b3
4ca083a
c01c944
03913a6
f2780b2
3be7718
f1e90ec
2880f9e
46b983d
646a425
53abb78
5ac2d55
7f23b7b
1a62c23
69add5f
079554f
d080b0c
62255c2
21b90d8
7308937
334cda5
cf2d1e4
923f05c
5410ee4
6f47931
edf64ae
894e4e1
59b3b90
82356f2
036ce6f
bf2edc4
b2fa115
783baf4
7ea0fe7
aa0480a
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 |
|---|---|---|
|
|
@@ -125,7 +125,7 @@ describe('helper', () => { | |
|
|
||
| assert.throws(() => { | ||
| replaceProjectIdToken(frozenObj, projectId); | ||
| }, /Cannot assign to read only property/); | ||
| }, /Cannot assign to read only property|Attempted to assign to readonly property/); | ||
|
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. Not really commentary for this PR, but it might be cool to collect some of these differences in
Contributor
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. Agreed — centralizing runtime-agnostic error assertions and environment checks in test-utils (or asserting on the error type rather than engine-specific message strings) will be much cleaner as we expand Bun (and potentially Deno) support. We'll track this as a follow-up task.
Contributor
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. Will be addressed in #9492 |
||
| }); | ||
|
|
||
| it('should replace more than one {{projectId}}', () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,7 +196,10 @@ describe('PartialResultStream', () => { | |
| // Node 18's assert.deepStrictEqual strictly requires prototype equality, | ||
| // which fails when comparing RowImpl (an Array subclass) with a plain Array literal. | ||
| // Node 20+ relaxed this for Array subclasses with constructor = Array. | ||
| if (parseInt(process.versions.node.split('.')[0], 10) < 20) { | ||
| if ( | ||
| parseInt(process.versions.node.split('.')[0], 10) < 20 || | ||
|
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. Same for this kind of thing. We could have predicates in test-utils that do this sort of test.
Contributor
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. Agreed — adding runtime capability predicates or assertion helpers in test-utils so individual package tests don't need inline process.versions checks makes sense as a follow-up.
Contributor
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. Will be addressed in #9492 |
||
| process.versions.bun | ||
| ) { | ||
| assert.deepStrictEqual([...row], EXPECTED_ROW); | ||
| } else { | ||
| assert.deepStrictEqual(row, EXPECTED_ROW); | ||
|
|
@@ -260,7 +263,10 @@ describe('PartialResultStream', () => { | |
| // Node 18's assert.deepStrictEqual strictly requires prototype equality, | ||
| // which fails when comparing RowImpl (an Array subclass) with a plain Array literal. | ||
| // Node 20+ relaxed this for Array subclasses with constructor = Array. | ||
| if (parseInt(process.versions.node.split('.')[0], 10) < 20) { | ||
| if ( | ||
| parseInt(process.versions.node.split('.')[0], 10) < 20 || | ||
| process.versions.bun | ||
| ) { | ||
| assert.deepStrictEqual([...row], EXPECTED_ROW); | ||
| } else { | ||
| assert.deepStrictEqual(row, EXPECTED_ROW); | ||
|
|
||
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 sure there's a reason for it given that there's another above, but I'm curious why the mix of require and import?
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 follows the existing pattern across the observability-test suite (e.g., observability-test/spanner.ts), where the OpenTelemetry packages and ./helper were originally loaded via require() (in part because NodeTracerProvider is passed an untyped exporter property in its config object, which would fail strict TypeScript checks if imported via ES import, and @opentelemetry/sdk-trace-base was originally a transitive dependency). We kept require() here to stay consistent with the rest of the file.
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 also noticed when we did the Node upgrade last year that we had to play with require/import a lot to eliminate compiler errors so that might be another reason we see this discrepancy.