Skip to content

Commit

Permalink
Merge branch 'master' into eslint-plugin-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHenry committed Feb 9, 2024
2 parents c0f46cc + a568df2 commit e2568a5
Show file tree
Hide file tree
Showing 27 changed files with 517 additions and 75 deletions.
4 changes: 2 additions & 2 deletions docs/generated/manifests/ci.json
Expand Up @@ -176,7 +176,7 @@
},
{
"id": "split-e2e-tasks",
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/split-e2e-tasks",
Expand Down Expand Up @@ -258,7 +258,7 @@
},
"/ci/features/split-e2e-tasks": {
"id": "split-e2e-tasks",
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/split-e2e-tasks",
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/manifests/menus.json
Expand Up @@ -5779,7 +5779,7 @@
"disableCollapsible": false
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"path": "/ci/features/split-e2e-tasks",
"id": "split-e2e-tasks",
"isExternal": false,
Expand Down Expand Up @@ -5838,7 +5838,7 @@
"disableCollapsible": false
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"path": "/ci/features/split-e2e-tasks",
"id": "split-e2e-tasks",
"isExternal": false,
Expand Down
5 changes: 5 additions & 0 deletions docs/generated/packages/angular/executors/dev-server.json
Expand Up @@ -105,6 +105,11 @@
"type": "number",
"description": "Enable and define the file watching poll time period in milliseconds."
},
"forceEsbuild": {
"type": "boolean",
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system. _Note: this is only supported in Angular versions >= 16.1.0_.",
"default": false
},
"buildLibsFromSource": {
"type": "boolean",
"description": "Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the `browserTarget` options, or it will default to `true` if it's also not set in the `browserTarget` options.",
Expand Down
24 changes: 24 additions & 0 deletions docs/generated/packages/cypress/documents/overview.md
Expand Up @@ -75,6 +75,30 @@ The `@nx/cypress/plugin` is configured in the `plugins` array in `nx.json`.

The `@nx/cypress/plugin` will automatically split your e2e tasks by file. You can read more about this feature [here](/ci/features/split-e2e-tasks).

To enable e2e task splitting, make sure there is a `ciWebServerCommand` property set in your `cypress.config.ts` file. It will look something like this:

```ts {% fileName="apps/my-project-e2e/cypress.config.ts" highlightLines=[13] %}
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';

export default defineConfig({
e2e: {
...nxE2EPreset(__filename, {
cypressDir: 'src',
bundler: 'vite',
webServerCommands: {
default: 'nx run my-project:serve',
production: 'nx run my-project:preview',
},
ciWebServerCommand: 'nx run my-project:serve-static',
}),
baseUrl: 'http://localhost:4200',
},
});
```

Note: The `nxE2EPreset` is a collection of default settings, but is not necessary for task splitting.

{% /tab %}
{% tab label="Nx < 18" %}

Expand Down
2 changes: 1 addition & 1 deletion docs/map.json
Expand Up @@ -1712,7 +1712,7 @@
"file": "nx-cloud/features/dynamic-agents"
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"id": "split-e2e-tasks",
"file": "nx-cloud/features/split-e2e-tasks"
},
Expand Down
2 changes: 1 addition & 1 deletion docs/nx-cloud/features/dynamic-agents.md
Expand Up @@ -10,7 +10,7 @@ The standard way to set up [Nx Agents](/ci/features/distribute-task-execution) i

```yaml {% fileName=".nx/workflows/dynamic-changesets.yaml" %}
distribute-on:
small-changeset: 1 linux-medium-js
small-changeset: 3 linux-medium-js
medium-changeset: 6 linux-medium-js
large-changeset: 10 linux-medium-js
```
Expand Down
Binary file added docs/nx-cloud/features/flaky-tasks-ci.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 9 additions & 3 deletions docs/nx-cloud/features/flaky-tasks.md
Expand Up @@ -8,14 +8,20 @@ Nx is perfectly positioned to detect which tasks are flaky and automatically re-

Nx creates a hash of all the inputs for a task whenever it is run. If Nx ever encounters a task that fails with a particular set of inputs and then succeeds with those same inputs, Nx knows for a fact that the task is flaky. Nx can't know with certainty when the task has been fixed to no longer be flaky, so if a particular task has no flakiness incidents for 2 weeks, the `flaky` flag is removed for that task.

## Manually Mark a Task as Flaky or Not Flaky
![Flaky tasks in CI](/nx-cloud/features/flaky-tasks-ci.png)

If you need to manually mark a task as flaky or not flaky, you can do so from the run details screen. Flaky tasks will have a button that says `Mark task as no longer flaky` and failed tasks that are not flaky will have a button that says `Mark task as likely flaky`. Using these buttons, you can ensure that Nx Cloud treats tasks in the appropriate way.
In this image, the `e2e-ci--src/e2e/app.cy.ts` task is a flaky task that has been automatically retried once. There is a `1 retry` indicator to show that it has been retried and, once expanded, you can see tabs that contain the logs for `Attempt 1` and `Attempt 2`. With this UI, you can easily compare the output between a successful and unsuccessful run of a flaky task.

![Mark task as no longer flaky button](/nx-cloud/features/mark-task-as-no-longer-flaky.png)
## Manually Mark a Task as Flaky or Not Flaky

If you suspect that a task is flaky, but Nx has not confirmed it yet, you can manually mark it as `likely flaky` from the run details screen. Failed tasks that are not flaky will have a button that says `Mark task as likely flaky`.

![Mark task as likely flaky button](/nx-cloud/features/mark-task-as-likely-flaky.png)

Once you've resolved the issue that caused a task to be flaky, you can immediately mark the task as not flaky by clicking on `Mark task as no longer flaky` on the same run details screen.

![Mark task as no longer flaky button](/nx-cloud/features/mark-task-as-no-longer-flaky.png)

## Re-run Flaky Tasks

When a flaky task fails in CI with [distributed task execution](/ci/features/distribute-task-execution) enabled, Nx will automatically send that task to a different agent and run it again (up to 2 tries in total). Its important to run the task on a different agent to ensure that the agent itself or the other tasks that were run on that agent are not the reason for the flakiness.
Binary file modified docs/nx-cloud/features/mark-task-as-no-longer-flaky.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e2568a5

Please sign in to comment.