Skip to content

Create typescript tests for apis - #2480

Merged
tewaro merged 1 commit into
mainfrom
AdityaAtulTewari/typescript-tests-for-apis
Aug 6, 2024
Merged

Create typescript tests for apis#2480
tewaro merged 1 commit into
mainfrom
AdityaAtulTewari/typescript-tests-for-apis

Conversation

@tewaro

Copy link
Copy Markdown
Contributor

No description provided.

@tewaro
tewaro requested review from a team as code ownersAugust 6, 2024 04:48
@tewarotewaro mentioned this pull request Aug 6, 2024

@hoodmanehoodmane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @AdityaAtulTewari.

Comment threadbuild/wd_test.bzl Outdated
Comment threadbuild/wd_test.bzl Outdated
Comment threadbuild/wd_test.bzl Outdated
data = data + [src, "//src/workerd/server:workerd"]
data = data + [src, "//src/workerd/server:workerd"] + srcs

ts_srcs = [src for src in srcs if src.endswith(".ts")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason you need the new srcs argument at all? Why not just filter data for arguments that end in *.ts? It seems simpler to me.

@tewarotewaroAug 6, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

  • Honestly it was cleaner to help me debug at first, I can collapse them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does the failure look like if there is a type error? Would it be possible to add a test_ts_testing that forces a type error and asserts that it looks correct? Or did you manually verify this?

It looks to me like type errors generate build errors rather than test failures. Ideally we should probably use tsc --noCheck at build time and run tsc --noEmit as part of the test. But annoyingly, it looks like the --noCheck CLI option is only going to be released as part of typescript v5.6:
microsoft/TypeScript#58839

So maybe we can add this as a TODO for when typescript 5.6 comes out.

@tewarotewaroAug 6, 2024

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

  • That makes sense I can add that todo

@tewaro
tewaroforce-pushed the AdityaAtulTewari/typescript-tests-for-apis branch from 8ad05a6 to 0d67399CompareAugust 6, 2024 16:47
@tewaro
tewaro requested a review from hoodmaneAugust 6, 2024 16:47
@tewaro
tewaroforce-pushed the AdityaAtulTewari/typescript-tests-for-apis branch from 0d67399 to 05a6ecfCompareAugust 6, 2024 18:02
@tewaro
tewaro merged commit dd7e463 into mainAug 6, 2024
@tewaro
tewaro deleted the AdityaAtulTewari/typescript-tests-for-apis branch August 6, 2024 19:29
Sign up for freeto 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.

2 participants

@tewaro@hoodmane