Nx
Enterprise
Nx
Sign in / Sign up
Open main menu
Nx
GitHub
Overview
Runs
Analytics
Loading workspace stats
Loading workspace insights...
Statistics interval
7 days
30 days
Latest CI Pipeline Executions
Status
Fix filter
Filter
Fuzzy
Filter range
Sort by
Sort by
Start time
Sort ascending
Sort descending
Failed
master
b8b6ed8b fix(testing): use surgical text replacement in Jest matcher alias migration (#34350) ## Current Behavior The `replace-removed-matcher-aliases` migration uses `tsquery.replace()` which reprints the entire AST through TypeScript's Printer. This causes two problems: 1. **Syntax corruption**: Valid TypeScript files are mangled: - Destructuring patterns: `{ result }` becomes `{result}:` - Arrow functions: missing opening braces - Nested callbacks: collapsed/merged code blocks 2. **Unnecessary file changes**: Every test file is written back to disk even when no matchers are replaced. This triggers `formatFiles()` to reformat unchanged files, creating large whitespace-only diffs. In large codebases, this can result in hundreds or thousands of files being modified unnecessarily, making the migration PR difficult to review. **Why I care a Lot** I was running this on a multi-million-LOC monorepo and ran into two issues: * I got ~10k modified files with whitespace-only changes from the removal of newlines. These changes couldn't be fixed with Prettier because it didn't care about the number of newlines, so the diff was unmergeable. * I got ~8 files with malformed Typescript, causing commit hooks, CI, etc. to fail without manual intervention. ## Expected Behavior The migration should: 1. Only replace the deprecated matcher names (e.g., `toBeCalled` → `toHaveBeenCalled`) 2. Preserve all surrounding code exactly as written 5. Only touch files that actually contain deprecated matchers ## Solution Replace AST-reprinting with surgical text replacement: - Use `tsquery.query()` to find matching AST nodes - Collect text positions (start/end) for each node to replace - Apply replacements in reverse order using string slicing - Only write files that actually changed This pattern is already used successfully in other Nx migrations (e.g., `rename-cy-exec-code-property.ts` in the Cypress package). **Additional improvements:** - Single AST parse with regex selector vs. 11 separate passes - Quick string check skips parsing files without deprecated matchers - New regression test covers complex patterns that triggered corruption ## Related Issue(s) Fixes #32062 --------- Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
5 days ago
by baer
b
Failed
master
b8b6ed8b fix(testing): use surgical text replacement in Jest matcher alias migration (#34350) ## Current Behavior The `replace-removed-matcher-aliases` migration uses `tsquery.replace()` which reprints the entire AST through TypeScript's Printer. This causes two problems: 1. **Syntax corruption**: Valid TypeScript files are mangled: - Destructuring patterns: `{ result }` becomes `{result}:` - Arrow functions: missing opening braces - Nested callbacks: collapsed/merged code blocks 2. **Unnecessary file changes**: Every test file is written back to disk even when no matchers are replaced. This triggers `formatFiles()` to reformat unchanged files, creating large whitespace-only diffs. In large codebases, this can result in hundreds or thousands of files being modified unnecessarily, making the migration PR difficult to review. **Why I care a Lot** I was running this on a multi-million-LOC monorepo and ran into two issues: * I got ~10k modified files with whitespace-only changes from the removal of newlines. These changes couldn't be fixed with Prettier because it didn't care about the number of newlines, so the diff was unmergeable. * I got ~8 files with malformed Typescript, causing commit hooks, CI, etc. to fail without manual intervention. ## Expected Behavior The migration should: 1. Only replace the deprecated matcher names (e.g., `toBeCalled` → `toHaveBeenCalled`) 2. Preserve all surrounding code exactly as written 5. Only touch files that actually contain deprecated matchers ## Solution Replace AST-reprinting with surgical text replacement: - Use `tsquery.query()` to find matching AST nodes - Collect text positions (start/end) for each node to replace - Apply replacements in reverse order using string slicing - Only write files that actually changed This pattern is already used successfully in other Nx migrations (e.g., `rename-cy-exec-code-property.ts` in the Cypress package). **Additional improvements:** - Single AST parse with regex selector vs. 11 separate passes - Quick string check skips parsing files without deprecated matchers - New regression test covers complex patterns that triggered corruption ## Related Issue(s) Fixes #32062 --------- Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
5 days ago
by baer
b
Failed
34491
05e6b74c fix(core): properly quote shell metacharacters in CLI args passed to tasks When CLI arguments containing shell metacharacters (like |, &, $, etc.) were passed through Nx to underlying tasks, they were not properly quoted, causing shell interpretation errors. For example: nx test app --grep="@tag1|@tag2" Would fail because the pipe character was interpreted by the shell as a command pipe, resulting in errors like "/bin/sh: @tag2: command not found". This fix: - Introduces a new `needsShellQuoting()` utility that detects all shell metacharacters: | & ; < > ( ) $ ` \ " ' * ? [ ] { } ~ # ! and whitespace - Updates `wrapArgIntoQuotesIfNeeded()` to use this utility instead of only checking for spaces - Properly handles values containing `=` by splitting on the first `=` only - Escapes existing double quotes within values before wrapping - Adds comprehensive test coverage for the new functionality Fixes #32305 Fixes #26682
5 days ago
by baer
b
Succeeded
34350
881b4791 fix(testing): use surgical text replacement in Jest matcher alias migration The `replace-removed-matcher-aliases` migration was corrupting TypeScript files by using `tsquery.replace()`, which reprints the entire AST through TypeScript's Printer. This caused several issues: 1. **Syntax corruption**: The Printer would mangle complex patterns like destructuring (`{ result }` → `{result}:`), arrow functions (missing opening braces), and nested callbacks (collapsed blocks). 2. **Unnecessary reformatting**: Every test file was written back to disk even if no matchers were replaced, causing `formatFiles()` to reformat files that didn't need changes. This fix replaces the AST-reprinting approach with surgical text replacement: - Use `tsquery.query()` to find matching AST nodes - Collect text positions (start/end) for each node to replace - Apply replacements in reverse order using string slicing - Only write files that actually changed This pattern is already used successfully in other Nx migrations (e.g., `rename-cy-exec-code-property.ts` in the Cypress package). Additional improvements: - Single AST parse with regex selector vs. 11 separate passes - Quick string check skips parsing files without deprecated matchers - New regression test covers complex patterns that triggered corruption Fixes #32062
5 days ago
by baer
b
Failed
34491
Generating fix
→
05e6b74c fix(core): properly quote shell metacharacters in CLI args passed to tasks When CLI arguments containing shell metacharacters (like |, &, $, etc.) were passed through Nx to underlying tasks, they were not properly quoted, causing shell interpretation errors. For example: nx test app --grep="@tag1|@tag2" Would fail because the pipe character was interpreted by the shell as a command pipe, resulting in errors like "/bin/sh: @tag2: command not found". This fix: - Introduces a new `needsShellQuoting()` utility that detects all shell metacharacters: | & ; < > ( ) $ ` \ " ' * ? [ ] { } ~ # ! and whitespace - Updates `wrapArgIntoQuotesIfNeeded()` to use this utility instead of only checking for spaces - Properly handles values containing `=` by splitting on the first `=` only - Escapes existing double quotes within values before wrapping - Adds comprehensive test coverage for the new functionality Fixes #32305 Fixes #26682
6 days ago
by baer
b
Succeeded
master
3b0fb815 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336) ## Current Behavior When running generators or migrations, Nx automatically skips Prettier formatting if no root Prettier config is detected (added in #30426). However, there's no way to explicitly skip Prettier formatting when a config IS present but the user wants to bypass it for specific operations. This can be needed when: - When running something like Oxfmt that may treat prettier slightly differently, even with the same config (this is the main thing I ran into) - Running migrations where Prettier reformatting causes unintended side effects (e.g., breaking `eslint-disable` comments) - Temporarily disabling formatting for debugging purposes - Using a formatter that coexists with Prettier in the workspace but should take precedence for certain files ## Expected Behavior Users can set `NX_SKIP_FORMAT=true` to explicitly skip Prettier formatting in generators and migrations, regardless of whether Prettier is configured. TSConfig path sorting (controlled by `sortRootTsconfigPaths` or `NX_FORMAT_SORT_TSCONFIG_PATHS`) continues to work independently. ```bash NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-app ``` ## Related Issue(s) Related to #30403 and #30426. This enhancement adds explicit user control for cases where auto-detection of Prettier configuration isn't sufficient.
13 days ago
by baer
b
Failed
master
3b0fb815 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336) ## Current Behavior When running generators or migrations, Nx automatically skips Prettier formatting if no root Prettier config is detected (added in #30426). However, there's no way to explicitly skip Prettier formatting when a config IS present but the user wants to bypass it for specific operations. This can be needed when: - When running something like Oxfmt that may treat prettier slightly differently, even with the same config (this is the main thing I ran into) - Running migrations where Prettier reformatting causes unintended side effects (e.g., breaking `eslint-disable` comments) - Temporarily disabling formatting for debugging purposes - Using a formatter that coexists with Prettier in the workspace but should take precedence for certain files ## Expected Behavior Users can set `NX_SKIP_FORMAT=true` to explicitly skip Prettier formatting in generators and migrations, regardless of whether Prettier is configured. TSConfig path sorting (controlled by `sortRootTsconfigPaths` or `NX_FORMAT_SORT_TSCONFIG_PATHS`) continues to work independently. ```bash NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-app ``` ## Related Issue(s) Related to #30403 and #30426. This enhancement adds explicit user control for cases where auto-detection of Prettier configuration isn't sufficient.
13 days ago
by baer
b
Failed
master
3b0fb815 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336) ## Current Behavior When running generators or migrations, Nx automatically skips Prettier formatting if no root Prettier config is detected (added in #30426). However, there's no way to explicitly skip Prettier formatting when a config IS present but the user wants to bypass it for specific operations. This can be needed when: - When running something like Oxfmt that may treat prettier slightly differently, even with the same config (this is the main thing I ran into) - Running migrations where Prettier reformatting causes unintended side effects (e.g., breaking `eslint-disable` comments) - Temporarily disabling formatting for debugging purposes - Using a formatter that coexists with Prettier in the workspace but should take precedence for certain files ## Expected Behavior Users can set `NX_SKIP_FORMAT=true` to explicitly skip Prettier formatting in generators and migrations, regardless of whether Prettier is configured. TSConfig path sorting (controlled by `sortRootTsconfigPaths` or `NX_FORMAT_SORT_TSCONFIG_PATHS`) continues to work independently. ```bash NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-app ``` ## Related Issue(s) Related to #30403 and #30426. This enhancement adds explicit user control for cases where auto-detection of Prettier configuration isn't sufficient.
13 days ago
by baer
b
Failed
master
3b0fb815 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting (#34336) ## Current Behavior When running generators or migrations, Nx automatically skips Prettier formatting if no root Prettier config is detected (added in #30426). However, there's no way to explicitly skip Prettier formatting when a config IS present but the user wants to bypass it for specific operations. This can be needed when: - When running something like Oxfmt that may treat prettier slightly differently, even with the same config (this is the main thing I ran into) - Running migrations where Prettier reformatting causes unintended side effects (e.g., breaking `eslint-disable` comments) - Temporarily disabling formatting for debugging purposes - Using a formatter that coexists with Prettier in the workspace but should take precedence for certain files ## Expected Behavior Users can set `NX_SKIP_FORMAT=true` to explicitly skip Prettier formatting in generators and migrations, regardless of whether Prettier is configured. TSConfig path sorting (controlled by `sortRootTsconfigPaths` or `NX_FORMAT_SORT_TSCONFIG_PATHS`) continues to work independently. ```bash NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-app ``` ## Related Issue(s) Related to #30403 and #30426. This enhancement adds explicit user control for cases where auto-detection of Prettier configuration isn't sufficient.
13 days ago
by baer
b
Succeeded
34336
97b1c242 feat(devkit): add NX_SKIP_FORMAT environment variable to skip Prettier formatting Add support for skipping Prettier formatting in generators and migrations via the `NX_SKIP_FORMAT` environment variable. This is useful for repositories that: - Use alternative formatters like Biome, dprint, or oxfmt - Have custom formatting requirements that conflict with Prettier defaults - Experience issues where Prettier reformatting breaks eslint-disable comments When `NX_SKIP_FORMAT=true`, the `formatFiles()` function and related formatting utilities will skip Prettier formatting but will still perform tsconfig path sorting if enabled via `sortRootTsconfigPaths` option or `NX_FORMAT_SORT_TSCONFIG_PATHS` environment variable. Usage: NX_SKIP_FORMAT=true nx migrate --run-migrations NX_SKIP_FORMAT=true nx g @nx/react:app my-app Also updates `formatChangedFilesWithPrettierIfAvailable` and `formatFilesWithPrettierIfAvailable` in the nx package to respect this environment variable. Related: #30403, #30426
14 days ago
by baer
b
Previous page
Previous
Next
Next page