@@ -95,7 +95,50 @@ class NpxTask_integTest extends AbstractIntegTest {
9595
9696 // This is cursed, see npx-env/build.gradle for details
9797 @IgnoreIf({ System.getProperty("os.name").toLowerCase().contains("windows") })
98- def 'execute npx command with custom execution configuration and check up-to-date-detection'() {
98+ def 'execute npx pwd command with custom execution configuration and check up-to-date-detection'() {
99+ given:
100+ gradleVersion = gv
101+
102+ copyResources("fixtures/npx-env/")
103+ copyResources("fixtures/env/")
104+
105+ when:
106+ def result7 = build(":pwd")
107+
108+ then:
109+ result7.task(":pwd").outcome == TaskOutcome.SUCCESS
110+ result7.output.contains("workingDirectory='${projectDir}'")
111+
112+ when:
113+ def result8 = build(":pwd", "-DcustomWorkingDir=true")
114+
115+ then:
116+ result8.task(":pwd").outcome == TaskOutcome.UP_TO_DATE
117+
118+ when:
119+ def result9 = build(":pwd", "-DcustomWorkingDir=true", "--rerun-tasks")
120+
121+ then:
122+ result9.task(":nodeSetup").outcome == TaskOutcome.SUCCESS
123+ result9.task(":npmSetup").outcome == TaskOutcome.SKIPPED
124+ result9.task(":npmInstall").outcome == TaskOutcome.SUCCESS
125+ result9.task(":pwd").outcome == TaskOutcome.SUCCESS
126+ def expectedWorkingDirectory = "${projectDir}${File.separator}build${File.separator}customWorkingDirectory"
127+ result9.output.contains("workingDirectory='${expectedWorkingDirectory}'")
128+ new File(expectedWorkingDirectory).isDirectory()
129+
130+ when:
131+ def result10 = build(":version")
132+
133+ then:
134+ result10.task(":version").outcome == TaskOutcome.SUCCESS
135+ result10.output.contains("> Task :version${System.lineSeparator()}${DEFAULT_NPM_VERSION}")
136+
137+ where:
138+ gv << GRADLE_VERSIONS_UNDER_TEST
139+ }
140+
141+ def 'execute npx env command with custom execution configuration and check up-to-date-detection'() {
99142 given:
100143 gradleVersion = gv
101144
@@ -154,7 +197,7 @@ class NpxTask_integTest extends AbstractIntegTest {
154197 result5.output.contains("E404")
155198
156199 when:
157- def result6 = build(":env", "-DoutputFile=true")
200+ def result6 = build(":env", "-DoutputFile=true", "--stacktrace" )
158201
159202 then:
160203 result6.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
@@ -166,44 +209,6 @@ class NpxTask_integTest extends AbstractIntegTest {
166209 outputFile.exists()
167210 environmentDumpContainsPathVariable(outputFile.text)
168211
169- when:
170- def result7 = build(":pwd")
171-
172- then:
173- result7.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
174- result7.task(":npmSetup").outcome == TaskOutcome.SKIPPED
175- result7.task(":npmInstall").outcome == TaskOutcome.UP_TO_DATE
176- result7.task(":pwd").outcome == TaskOutcome.SUCCESS
177- result7.output.contains("workingDirectory='${projectDir}'")
178-
179- when:
180- def result8 = build(":pwd", "-DcustomWorkingDir=true")
181-
182- then:
183- result8.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
184- result8.task(":npmSetup").outcome == TaskOutcome.SKIPPED
185- result8.task(":npmInstall").outcome == TaskOutcome.UP_TO_DATE
186- result8.task(":pwd").outcome == TaskOutcome.UP_TO_DATE
187-
188- when:
189- def result9 = build(":pwd", "-DcustomWorkingDir=true", "--rerun-tasks")
190-
191- then:
192- result9.task(":nodeSetup").outcome == TaskOutcome.SUCCESS
193- result9.task(":npmSetup").outcome == TaskOutcome.SKIPPED
194- result9.task(":npmInstall").outcome == TaskOutcome.SUCCESS
195- result9.task(":pwd").outcome == TaskOutcome.SUCCESS
196- def expectedWorkingDirectory = "${projectDir}${File.separator}build${File.separator}customWorkingDirectory"
197- result9.output.contains("workingDirectory='${expectedWorkingDirectory}'")
198- new File(expectedWorkingDirectory).isDirectory()
199-
200- when:
201- def result10 = build(":version")
202-
203- then:
204- result10.task(":version").outcome == TaskOutcome.SUCCESS
205- result10.output.contains("> Task :version${System.lineSeparator()}${DEFAULT_NPM_VERSION}")
206-
207212 where:
208213 gv << GRADLE_VERSIONS_UNDER_TEST
209214 }
0 commit comments