Skip to content

Commit 41214ab

Browse files
committed
Most of the prettier steps don't depend on the filename, so there's no need to bring in that complexity.
1 parent 40048d0 commit 41214ab

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

testlib/src/test/java/com/diffplug/spotless/npm/PrettierFormatterStepTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void formattingUsingConfigFile() throws Exception {
6060
npmExecutable(),
6161
new PrettierConfig(prettierRc, null));
6262

63-
try (StepHarnessWithFile stepHarness = StepHarnessWithFile.forStep(formatterStep)) {
63+
try (StepHarness stepHarness = StepHarness.forStep(formatterStep)) {
6464
stepHarness.testResource(dirtyFile, cleanFile);
6565
}
6666
}
@@ -83,7 +83,7 @@ public void parserInferenceBasedOnExplicitFilepathIsWorking() throws Exception {
8383
npmExecutable(),
8484
new PrettierConfig(null, ImmutableMap.of("filepath", "anyname.json"))); // should select parser based on this name
8585

86-
try (StepHarnessWithFile stepHarness = StepHarnessWithFile.forStep(formatterStep)) {
86+
try (StepHarness stepHarness = StepHarness.forStep(formatterStep)) {
8787
stepHarness.testResource(dirtyFile, cleanFile);
8888
}
8989
}
@@ -103,7 +103,7 @@ public void parserInferenceBasedOnFilenameIsWorking() throws Exception {
103103
new PrettierConfig(null, Collections.emptyMap()));
104104

105105
try (StepHarnessWithFile stepHarness = StepHarnessWithFile.forStep(formatterStep)) {
106-
stepHarness.testResource(dirtyFile, cleanFile);
106+
stepHarness.testResource(new File("test.json"), dirtyFile, cleanFile);
107107
}
108108
}
109109

@@ -115,7 +115,7 @@ public void verifyPrettierErrorMessageIsRelayed() throws Exception {
115115
buildDir(),
116116
npmExecutable(),
117117
new PrettierConfig(null, ImmutableMap.of("parser", "postcss")));
118-
try (StepHarnessWithFile stepHarness = StepHarnessWithFile.forStep(formatterStep)) {
118+
try (StepHarness stepHarness = StepHarness.forStep(formatterStep)) {
119119
stepHarness.testException("npm/prettier/filetypes/scss/scss.dirty", exception -> {
120120
exception.hasMessageContaining("HTTP 501");
121121
exception.hasMessageContaining("Couldn't resolve parser \"postcss\"");
@@ -141,7 +141,7 @@ public void runFormatTest(PrettierConfig config, String cleanFileNameSuffix) thr
141141
npmExecutable(),
142142
config); // should select parser based on this name
143143

144-
try (StepHarnessWithFile stepHarness = StepHarnessWithFile.forStep(formatterStep)) {
144+
try (StepHarness stepHarness = StepHarness.forStep(formatterStep)) {
145145
stepHarness.testResource(dirtyFile, cleanFile);
146146
}
147147
}

0 commit comments

Comments
 (0)