Skip to content

Commit f1cded7

Browse files
committed
Split windows-incompatible test into two
1 parent 1a26e9f commit f1cded7

File tree

3 files changed

+55
-42
lines changed

3 files changed

+55
-42
lines changed

gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
org.gradle.unsafe.configuration-cache=true
2-
systemProp.gradle.enterprise.testretry.enabled=false
2+
systemProp.gradle.enterprise.testretry.enabled=false
3+
systemProp.org.gradle.unsafe.kotlin.assignment=true

src/test/groovy/com/github/gradle/node/npm/task/NpxTask_integTest.groovy

+51-40
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,56 @@ 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(":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'() {
99148
given:
100149
gradleVersion = gv
101150
@@ -154,7 +203,7 @@ class NpxTask_integTest extends AbstractIntegTest {
154203
result5.output.contains("E404")
155204
156205
when:
157-
def result6 = build(":env", "-DoutputFile=true")
206+
def result6 = build(":env", "-DoutputFile=true", "--stacktrace")
158207
159208
then:
160209
result6.task(":nodeSetup").outcome == TaskOutcome.UP_TO_DATE
@@ -166,44 +215,6 @@ class NpxTask_integTest extends AbstractIntegTest {
166215
outputFile.exists()
167216
environmentDumpContainsPathVariable(outputFile.text)
168217
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-
207218
where:
208219
gv << GRADLE_VERSIONS_UNDER_TEST
209220
}

src/test/resources/fixtures/npx-env/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ if (isPropertyEnabled("customWorkingDir")) {
6363
}
6464

6565
if (isPropertyEnabled("outputFile")) {
66+
def standardOutputFile = new File(buildDir, "standard-output.txt")
6667
env.execOverrides {
67-
standardOutput = new FileOutputStream("${buildDir}/standard-output.txt")
68+
standardOutput = new FileOutputStream(standardOutputFile)
6869
}
6970
}
7071

0 commit comments

Comments
 (0)