Skip to main content
In this exercise, deliberately break one calculation in the sample project, inspect the failure in RWX, then restore it—all before committing or pushing. Use the public project and workflow from the quickstart.

Before you start

Complete the quickstart, including its passing run. Open your terminal in the rwx-quickstart clone and check the source file:
This command should print nothing. Use the original example source for this exercise; preserve any changes you have already made before continuing. Your untracked .rwx/quickstart.yml can stay as it is. You need no local Node.js installation and no new repository access.

1. Make a change that fails a test

Open src/index.js. In calculateTotal, change:
to:
The calculation now adds each item’s price once, regardless of its quantity. Inspect the change:
The diff should contain:
Keep the edit local. The RWX CLI sends local changes with a new run, so you can check this change before committing or pushing it.

2. Run the test task

The --target test option includes the test task and its dependencies: code, node, and npm-install. The separate lint task is outside this run. The existing filter on npm-install lets RWX reuse dependency installation when only this source file changes. The CLI should report:
That is the expected checkpoint: a cloud test has caught the local regression.

3. Inspect the assertion

Open the run URL printed by the CLI. Select Tests, then expand Output under Index functions > calculateTotal > should calculate total for valid items. Look for 1 Failed, 19 Successful, and this assertion:
Failed test showing the expected total of 35 and actual total of 15 The test uses two items: a price of 10 with quantity 2, and a price of 5 with quantity 3. The correct total is 10 * 2 + 5 * 3 = 35. The changed calculation returns 10 + 5 = 15.

4. Restore the calculation and start a new run

In src/index.js, restore the original line:
Start a new run with the current local files:
The CLI should report Run result status: succeeded. Open the new run’s Tests tab and confirm 20 Successful. Restored source producing 20 successful test results Restoring the exact source from the quickstart can also make the test task a cache hit: RWX already has a successful result for those inputs. A new run checks the current input state and can reuse that result. Use rwx run after editing your files. Retrying the earlier failed run uses that run’s original inputs; it does not upload the local fix.

5. Check your local source

It should print nothing again. You have completed a local failure-and-fix loop in cloud CI without a commit or push.

If a step fails

Continue with running commands in a cloud sandbox to reuse one environment across commands and bring cloud file edits back to your machine.