Skip to content

Introduce opentelemetry in rewatch and setup new test infrastructure#8241

Draft
nojaf wants to merge 16 commits intorescript-lang:masterfrom
nojaf:migrate-rewatch-tests
Draft

Introduce opentelemetry in rewatch and setup new test infrastructure#8241
nojaf wants to merge 16 commits intorescript-lang:masterfrom
nojaf:migrate-rewatch-tests

Conversation

@nojaf
Copy link
Member

@nojaf nojaf commented Feb 5, 2026

This is a subset of #8231.

I wish to introduce open telemetry in Rewatch and migrate the bash tests to a new test suite.

The new tests would look like:

describe("build", () => {
  it("builds all packages from root", () =>
    runRewatchTest(async ({ cli }) => {
      await cli.build();
    }));
});

Where we capture all telemetry traces produced inside runRewatchTest and extract a deterministic snapshot of this:

// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`build > builds all packages from root 1`] = `
[
  "rewatch.build[working_dir=.]",
  "  initialize_build",
  "    packages.make",
  "      build.load_package_sources[package=@rewatch-test/app]",
  "      build.load_package_sources[package=@rewatch-test/library]",
  "      build.load_package_sources[package=rewatch-test-fixture]",
  "    packages.parse_packages",
  "    clean.cleanup_previous_build",
  "  incremental_build[module_count=3]",
  "    build.parse[dirty_modules=3]",
  "    build.compile",
  "      build.compile_wave[file_count=1]",
  "        build.compile_file[module=Library]",
  "      build.compile_wave[file_count=1]",
  "        build.compile_file[module=App]",
  "      build.compile_wave[file_count=1]",
  "        build.compile_file[module=Root]",
]
`;

With this telemetry we can easily update snapshots and assert all still works as expected.
By using Vitest we also have a proper test runner, so can run individual tests.
All tests also run in a sandbox folder in the /tmp, we they cannot interfere with each other.
And they can run in parallel.

The goal is too replace and remove the existing bash tests.

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.

1 participant