From ae0fdeb88fcae07fb2e8ac193396639fde6286f7 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Thu, 27 Jun 2024 17:25:06 -0400 Subject: [PATCH] fix(gradle): fix gradle exclude src/test --- .../gradle/src/generators/init/init.spec.ts | 21 ++++++++++--------- packages/gradle/src/generators/init/init.ts | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/gradle/src/generators/init/init.spec.ts b/packages/gradle/src/generators/init/init.spec.ts index c1107825f4d512..c88c5b4b440491 100644 --- a/packages/gradle/src/generators/init/init.spec.ts +++ b/packages/gradle/src/generators/init/init.spec.ts @@ -81,16 +81,16 @@ describe('@nx/gradle:init', () => { }); const nxJson = readNxJson(tree); expect(nxJson.namedInputs).toMatchInlineSnapshot(` - { - "default": [ - "{projectRoot}/**/*", - ], - "production": [ - "default", - "!{projectRoot}/test/**/*", - ], - } - `); + { + "default": [ + "{projectRoot}/**/*", + ], + "production": [ + "default", + "!{projectRoot}/src/test/**/*", + ], + } + `); }); it('should not overwrite existing namedInputs', async () => { @@ -124,6 +124,7 @@ describe('@nx/gradle:init', () => { "!{projectRoot}/cypress.config.[jt]s", "!{projectRoot}/test/**/*", "default", + "!{projectRoot}/src/test/**/*", ], } `); diff --git a/packages/gradle/src/generators/init/init.ts b/packages/gradle/src/generators/init/init.ts index ae24c6831cfc1d..5e56eb1c4fe203 100644 --- a/packages/gradle/src/generators/init/init.ts +++ b/packages/gradle/src/generators/init/init.ts @@ -158,7 +158,7 @@ function updateNxJsonConfiguration(tree: Tree) { ); const productionFileSet = nxJson.namedInputs.production ?? []; nxJson.namedInputs.production = Array.from( - new Set([...productionFileSet, 'default', '!{projectRoot}/test/**/*']) + new Set([...productionFileSet, 'default', '!{projectRoot}/src/test/**/*']) ); updateNxJson(tree, nxJson); }