@@ -95,7 +95,50 @@ class NpxTask_integTest extends AbstractIntegTest {
95
95
96
96
// This is cursed, see npx-env/build.gradle for details
97
97
@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'() {
99
142
given:
100
143
gradleVersion = gv
101
144
@@ -154,7 +197,7 @@ class NpxTask_integTest extends AbstractIntegTest {
154
197
result5.output.contains("E404")
155
198
156
199
when:
157
- def result6 = build(":env", "-DoutputFile=true")
200
+ def result6 = build(":env", "-DoutputFile=true", "--stacktrace" )
158
201
159
202
then:
160
203
result6.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
@@ -166,44 +209,6 @@ class NpxTask_integTest extends AbstractIntegTest {
166
209
outputFile.exists()
167
210
environmentDumpContainsPathVariable(outputFile.text)
168
211
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
-
207
212
where:
208
213
gv << GRADLE_VERSIONS_UNDER_TEST
209
214
}
0 commit comments