@@ -95,7 +95,56 @@ 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(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
110
+ result7.task(":npmSetup").outcome == TaskOutcome.SKIPPED
111
+ result7.task(":npmInstall").outcome == TaskOutcome.UP_TO_DATE
112
+ result7.task(":pwd").outcome == TaskOutcome.SUCCESS
113
+ result7.output.contains("workingDirectory='${projectDir}'")
114
+
115
+ when:
116
+ def result8 = build(":pwd", "-DcustomWorkingDir=true")
117
+
118
+ then:
119
+ result8.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
120
+ result8.task(":npmSetup").outcome == TaskOutcome.SKIPPED
121
+ result8.task(":npmInstall").outcome == TaskOutcome.UP_TO_DATE
122
+ result8.task(":pwd").outcome == TaskOutcome.UP_TO_DATE
123
+
124
+ when:
125
+ def result9 = build(":pwd", "-DcustomWorkingDir=true", "--rerun-tasks")
126
+
127
+ then:
128
+ result9.task(":nodeSetup").outcome == TaskOutcome.SUCCESS
129
+ result9.task(":npmSetup").outcome == TaskOutcome.SKIPPED
130
+ result9.task(":npmInstall").outcome == TaskOutcome.SUCCESS
131
+ result9.task(":pwd").outcome == TaskOutcome.SUCCESS
132
+ def expectedWorkingDirectory = "${projectDir}${File.separator}build${File.separator}customWorkingDirectory"
133
+ result9.output.contains("workingDirectory='${expectedWorkingDirectory}'")
134
+ new File(expectedWorkingDirectory).isDirectory()
135
+
136
+ when:
137
+ def result10 = build(":version")
138
+
139
+ then:
140
+ result10.task(":version").outcome == TaskOutcome.SUCCESS
141
+ result10.output.contains("> Task :version${System.lineSeparator()}${DEFAULT_NPM_VERSION}")
142
+
143
+ where:
144
+ gv << GRADLE_VERSIONS_UNDER_TEST
145
+ }
146
+
147
+ def 'execute npx env command with custom execution configuration and check up-to-date-detection'() {
99
148
given:
100
149
gradleVersion = gv
101
150
@@ -154,7 +203,7 @@ class NpxTask_integTest extends AbstractIntegTest {
154
203
result5.output.contains("E404")
155
204
156
205
when:
157
- def result6 = build(":env", "-DoutputFile=true")
206
+ def result6 = build(":env", "-DoutputFile=true", "--stacktrace" )
158
207
159
208
then:
160
209
result6.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
@@ -166,44 +215,6 @@ class NpxTask_integTest extends AbstractIntegTest {
166
215
outputFile.exists()
167
216
environmentDumpContainsPathVariable(outputFile.text)
168
217
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
218
where:
208
219
gv << GRADLE_VERSIONS_UNDER_TEST
209
220
}
0 commit comments