Learn about Run Details View in Nx Cloud in less than 5 minutes — https://youtu.be/iGpwcNuYtlY
👨🏼💻 “Hey, I’ve got failing tests locally again :(”
👩🏾💻 “Which ones?”
👨🏼💻 “Uh…I’m not actually sure yet, I was running nx affected:test and it ended up testing all of the UI projects.”
👩🏾💻 “Can you show me?”
👨🏼💻 “Oh no…I’ve lost the command line output. My terminal buffer wasn’t big enough. I guess I’ll need to run the failed projects again.”
👩🏾💻 “Ok. Just give me a ping when you’re ready.”
👨🏼💻 “Sure. This might take a while…”
Running tests against lots of projects can be a problem even in a relatively small monorepo. Your command line output could be thousands of lines long and this can be a nightmare to sift through when looking for the output of that one failing project and the tests that caused the entire run to fail. There has to be a better way.
In CI/CD systems there is often a way to drill into the various runs that happen while testing the integrity of the latest pull request or merge into the main branch, but what about locally? Wouldn’t it be great if I could view that output in a better way and even share that with a colleague so we can get right into fixing the problem rather than trying to find it?
👩🏾💻 “I’ve had an idea, why don’t we connect our repo to the Nx Cloud app?”
👨🏼💻 “How do I do that?”
We’ve added a new argument,
--scan, that you can pass to any nx command. It will prompt you to connect to our Nx Cloud platform if necessary and then not only will you benefit from our free tier of compute caching but we will also log the output of that run and provide you a place to explore and share it!
Say I want to run the test targets in all the projects:
After completing the run you’ll see a message that gives you a URL where you can view your run details.
Following that URL will take you to the brand new Run Details view.
At the top you can see summary information about the run itself: how long it took, how many tasks failed and even some information about the machine that executed the run. Below all that are the executed tasks themselves, in this case each will be the execution of the test target against an individual project.
You can see at a glance the execution time of each task, whether it was a success or failure and even whether or not it was a cache hit or miss, but there might be too many to visually deal with. The project filter and toggles at the top allow you to reduce the tasks to only the ones you need to focus on.
Once you’ve found the project you need, you can expand the view to dig into the command line output itself.
👨🏼💻 “This is great, but should we really leave these open to anyone?”
👩🏾💻 “Let’s set up an organisation…”
If you’ve never connected your monorepo to Nx Cloud before the run detail view will be available to anyone with the unique url, so you can share that immediately. However, you’ll also see a message at the top of the page informing you that the workspace is currently public.
Claiming the workspace connects it to your Nx Cloud account and allows you to limit access to only those in your organisation.
To access the run detail view from a claimed workspace you will need an Nx Cloud account. Workspace owners can easily invite members to collaborate in their organisation.
One you’ve connected your monorepo to Nx Cloud we will provide unique urls to view each run that anyone working in the repository makes against it. We won’t record the command line output for every run unless you provide the
--scan argument each time, but if you’re sure you want to do this for every run, you can add
"scan" : true to the
nx.json at the root of the repository.
👨🏼💻 “Amazing, but what about all the runs that happen on each PR?”
👩🏾💻 “I think there’s an app for that…”
You can integrate our new Nx Cloud companion app into your GitHub repos and get a full report in your pull requests including links to each of the runs performed against them. You can see a full report from a recent pull request into our public Nx GitHub repository below.
We use Nx Cloud on all our repositories at Nrwl and we’ve already found it extremely useful for investigating runs with a lot of output and when collaborating remotely. We hope you find it useful too!
👨🏼💻 “Hey, I’ve got failing tests again. Here’s the run detail — https://nx.app/runs/…”
👩🏾💻 “Thanks! Oh, I see which test it is. I think I know what might be the problem. Do you want to jump on a call and we can fix this now?”
👨🏼💻 “Sure, let’s go!”