Skip to content

test: New integration tests#896

Merged
timfish merged 9 commits intomainfrom
timfish/test/integration-next
Mar 5, 2026
Merged

test: New integration tests#896
timfish merged 9 commits intomainfrom
timfish/test/integration-next

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Feb 28, 2026

This PR adds a new integration test package which will slowly replace the existing integration tests. For now I have only added Rolldown, partly because it has not been tested up until now. I will slowly migrate the other bundlers over and eventually remove the old integration tests.

The new integration tests run the bundler CLI's which allows us to test both CJS and ESM bundler configuration files. It also allows us to test the bundlers in complete isolation unlike the existing integration tests which call the JavaScript APIs of the bundlers. This has potential to leak context between tests, etc.

Rather than try and read the output files and assert specific code exists in the bundle, in the most part I just snapshot the entire output directory. As long as the snapshots are checked thoroughly for correctness, this is a much more robust way to see when unexpected changes occur. It also lets us test multiple features in less tests.

Worth noting:

  • @sentry/cli's helper.js is patched via patch-package so that we can also snapshot the cli args too
  • Each test has its own file which makes them fast, 17 tests in
    • 2s on my machine
    • 7s Ubuntu CI
    • 9s Windows CI

@github-actions
Copy link

github-actions bot commented Feb 28, 2026

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • Use crypto.randomUUID rather than uuid by timfish in #892

Internal Changes 🔧

  • New integration tests by timfish in #896
  • Remove lerna by timfish in #895
  • Migrate to Vitest by timfish in #894

🤖 This preview updates automatically when you update the PR.

@timfish timfish force-pushed the timfish/test/integration-next branch 3 times, most recently from 531df3b to dfa1552 Compare March 1, 2026 20:05
@timfish timfish force-pushed the timfish/test/integration-next branch from dfa1552 to e93d586 Compare March 1, 2026 20:11
@timfish timfish marked this pull request as ready for review March 3, 2026 15:19
@timfish timfish requested review from andreiborza and chargome March 3, 2026 15:19
cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment on lines +122 to +129
if (process.env["SENTRY_TEST_OUT_DIR"]) {
// eslint-disable-next-line @typescript-eslint/unbound-method
const { join } = await import("node:path");
const { appendFileSync } = await import("node:fs");
const path = join(process.env["SENTRY_TEST_OUT_DIR"], "sentry-telemetry.json");
appendFileSync(path, JSON.stringify(request) + ",\n");
return { statusCode: 200 };
}
Copy link
Member

Choose a reason for hiding this comment

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

q: Not blocking but would there be a way around this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried a mock server but spent too long trying to get it working and then found we already did something similar above for the existing integration tests.

I will revisit this though!

"outputs": [],
"cache": true
"inputs": ["default"],
"cache": false
Copy link
Member

Choose a reason for hiding this comment

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

q: That is intentional I guess?

Copy link
Collaborator Author

@timfish timfish Mar 4, 2026

Choose a reason for hiding this comment

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

It was intentional but this probably needs revising too.

I was changing the integration tests and re-running and it was hitting the cache.

Should we ever cache test output?

Copy link
Member

Choose a reason for hiding this comment

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

No let's not

@timfish timfish merged commit ef7d97f into main Mar 5, 2026
33 checks passed
@timfish timfish deleted the timfish/test/integration-next branch March 5, 2026 23:42
Sign up for free to 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