Skip to content

chore(tests): add type annotations to integration test helpers#7240

Merged
watson merged 2 commits intomasterfrom
watson/DEBUG-4402/clean-up-ts-errors
Jan 16, 2026
Merged

chore(tests): add type annotations to integration test helpers#7240
watson merged 2 commits intomasterfrom
watson/DEBUG-4402/clean-up-ts-errors

Conversation

@watson
Copy link
Copy Markdown
Collaborator

@watson watson commented Jan 14, 2026

What does this PR do?

As the title says

Motivation

I wanted to get integration-tests/helpers/index.js to a clean state where there's no more type errors.

@watson watson self-assigned this Jan 14, 2026
Copy link
Copy Markdown
Collaborator Author

watson commented Jan 14, 2026

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 14, 2026

Overall package size

Self size: 4.39 MB
Deduped: 5.21 MB
No deduping: 5.21 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 2.0.0 | 68.46 kB | 797.03 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.39%. Comparing base (0b7c8cc) to head (5d3f175).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #7240       +/-   ##
===========================================
- Coverage   85.13%   72.39%   -12.74%     
===========================================
  Files         532      204      -328     
  Lines       22654     7840    -14814     
===========================================
- Hits        19287     5676    -13611     
+ Misses       3367     2164     -1203     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@datadog-datadog-prod-us1

This comment has been minimized.

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented Jan 14, 2026

Benchmarks

Benchmark execution time: 2026-01-16 09:17:45

Comparing candidate commit 5d3f175 in PR branch watson/DEBUG-4402/clean-up-ts-errors with baseline commit 0b7c8cc in branch master.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 288 metrics, 32 unstable metrics.

@watson watson changed the base branch from watson/DEBUG-4402/spawn-proc-refactor to graphite-base/7240 January 14, 2026 11:37
@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from 78f4210 to cde62ed Compare January 14, 2026 11:38
@watson watson force-pushed the graphite-base/7240 branch from 09f5e10 to 2fe3616 Compare January 14, 2026 11:38
@watson watson changed the base branch from graphite-base/7240 to watson/DEBUG-4402/spawn-proc-refactor January 14, 2026 11:38
@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from cde62ed to 3d6a7b4 Compare January 14, 2026 11:40
@watson watson force-pushed the watson/DEBUG-4402/spawn-proc-refactor branch from 2fe3616 to 02625e4 Compare January 14, 2026 11:40
@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from 3d6a7b4 to 53223a1 Compare January 14, 2026 11:48
@watson watson force-pushed the watson/DEBUG-4402/spawn-proc-refactor branch from 02625e4 to dbfb772 Compare January 14, 2026 11:48
@watson watson changed the base branch from watson/DEBUG-4402/spawn-proc-refactor to graphite-base/7240 January 14, 2026 13:34
@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from 53223a1 to 87c16a4 Compare January 14, 2026 14:24
@watson watson changed the base branch from graphite-base/7240 to watson/DEBUG-4402/spawn-proc-refactor January 14, 2026 14:24
Base automatically changed from watson/DEBUG-4402/spawn-proc-refactor to master January 14, 2026 15:14
@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from 87c16a4 to 79f75bc Compare January 14, 2026 15:15
@watson watson marked this pull request as ready for review January 14, 2026 15:15
@watson watson requested a review from a team as a code owner January 14, 2026 15:15
Copy link
Copy Markdown
Member

@BridgeAR BridgeAR left a comment

Choose a reason for hiding this comment

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

Small suggestion for improvement about the port and it weakens some checks, which are probably not problematic, I thought I just ask.

Otherwise LGTM

Comment thread integration-tests/helpers/index.js Outdated
if (typeof actualMetadata.result !== 'string') {
throw new assert.AssertionError({ message: 'result field should be a string' })
}
if (typeof actualMetadata.result_class !== 'string') {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

These do not verify that the string has to be non empty. Is that intentional?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

My thought was that it was covered by the assertions below, but I see now that actualMetadata.result_reason isn't. I'll update the PR.

Background: The reason why I made this change was because TS wasn't sure that these were strings, so I needed an assertion that checked that they were strings so that TS wouldn't complain when I used them as input to validResults.includes and validResultClasses.includes. I'm not a fan of the way I fixed this, but I couldn't come up with a better approach. But let me know if you have any ideas.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed 👍

@@ -217,7 +217,7 @@ function spawnProc (filename, options = {}, stdioHandler, stderrHandler) {

return new Promise((resolve, reject) => {
proc
.on('message', ({ port }) => {
.on('message', (/** @type {{ port?: unknown }} */ { port }) => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should port not just be a number (or potentially a string?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I used unknown due to the type check below. The type check below is useful for catching runtime errors, so I don't want to remove that. I feels kinda weird to set it to number and then also have the type check. WDYT?

Comment on lines +127 to +131
for (let i = 0; i < args.length; i += 2) {
expectedPoints.push({
name: 'library_entrypoint.' + args[i],
tags: args[i + 1].split(',').filter(Boolean)
})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!

@watson watson force-pushed the watson/DEBUG-4402/clean-up-ts-errors branch from 79f75bc to 5d3f175 Compare January 16, 2026 09:08
@watson watson requested a review from BridgeAR January 16, 2026 09:09
@watson watson merged commit 3d6e608 into master Jan 16, 2026
796 checks passed
@watson watson deleted the watson/DEBUG-4402/clean-up-ts-errors branch January 16, 2026 11:43
@dd-octo-sts dd-octo-sts Bot mentioned this pull request Jan 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants