Skip to content

Commit 7be049e

Browse files
committed
fix: adapt tests to work with newer prettier versions
1 parent a249085 commit 7be049e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

plugin-gradle/src/test/java/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ void useNodeAndNpmFromNodeGradlePlugin() throws Exception {
4040
" npmWorkDir = file(\"${buildDir}/npm\")",
4141
"}",
4242
"def prettierConfig = [:]",
43-
"prettierConfig['printWidth'] = 50",
43+
"prettierConfig['printWidth'] = 20",
4444
"prettierConfig['parser'] = 'typescript'",
4545
"def npmExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/npm.cmd' : '/bin/npm'",
4646
"def nodeExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/node.exe' : '/bin/node'",
@@ -59,7 +59,7 @@ void useNodeAndNpmFromNodeGradlePlugin() throws Exception {
5959
// then run spotless using that node installation
6060
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
6161
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
62-
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile.clean");
62+
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
6363
} catch (Exception e) {
6464
printContents();
6565
throw e;
@@ -79,7 +79,7 @@ void useNodeAndNpmFromNodeGradlePlugin_example1() throws Exception {
7979
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
8080
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
8181
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
82-
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile.clean");
82+
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
8383
} catch (Exception e) {
8484
printContents();
8585
throw e;
@@ -93,7 +93,7 @@ void useNpmFromNodeGradlePlugin_example2() throws Exception {
9393
setFile("test.ts").toResource("npm/prettier/config/typescript.dirty");
9494
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
9595
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
96-
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile.clean");
96+
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
9797
} catch (Exception e) {
9898
printContents();
9999
throw e;
@@ -115,7 +115,7 @@ void useNpmFromNodeGradlePlugin() throws Exception {
115115
" workDir = file(\"${buildDir}/nodejs\")",
116116
"}",
117117
"def prettierConfig = [:]",
118-
"prettierConfig['printWidth'] = 50",
118+
"prettierConfig['printWidth'] = 20",
119119
"prettierConfig['parser'] = 'typescript'",
120120
"def npmExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/npm.cmd' : '/bin/npm'",
121121
"spotless {",
@@ -132,7 +132,7 @@ void useNpmFromNodeGradlePlugin() throws Exception {
132132
// then run spotless using that node installation
133133
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
134134
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
135-
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile.clean");
135+
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
136136
} catch (Exception e) {
137137
printContents();
138138
throw e;
@@ -154,7 +154,7 @@ void useNpmNextToConfiguredNodePluginFromNodeGradlePlugin() throws Exception {
154154
" workDir = file(\"${buildDir}/nodejs\")",
155155
"}",
156156
"def prettierConfig = [:]",
157-
"prettierConfig['printWidth'] = 50",
157+
"prettierConfig['printWidth'] = 20",
158158
"prettierConfig['parser'] = 'typescript'",
159159
"def nodeExec = System.getProperty('os.name').toLowerCase().contains('windows') ? '/node.exe' : '/bin/node'",
160160
"spotless {",
@@ -171,7 +171,7 @@ void useNpmNextToConfiguredNodePluginFromNodeGradlePlugin() throws Exception {
171171
// then run spotless using that node installation
172172
final BuildResult spotlessApply = gradleRunner().withArguments("--stacktrace", "spotlessApply").build();
173173
Assertions.assertThat(spotlessApply.getOutput()).contains("BUILD SUCCESSFUL");
174-
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile.clean");
174+
assertFile("test.ts").sameAsResource("npm/prettier/config/typescript.configfile_prettier_2.clean");
175175
} catch (Exception e) {
176176
printContents();
177177
throw e;

plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_1.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ node {
1616
npmWorkDir = file("${buildDir}/npm")
1717
}
1818
def prettierConfig = [:]
19-
prettierConfig['printWidth'] = 50
19+
prettierConfig['printWidth'] = 20
2020
prettierConfig['parser'] = 'typescript'
2121

2222
// the executable names

plugin-gradle/src/test/resources/com/diffplug/gradle/spotless/NpmTestsWithoutNpmInstallationTest_gradle_node_plugin_example_2.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ node {
1414
workDir = file("${buildDir}/nodejs")
1515
}
1616
def prettierConfig = [:]
17-
prettierConfig['printWidth'] = 50
17+
prettierConfig['printWidth'] = 20
1818
prettierConfig['parser'] = 'typescript'
1919

2020
// the executable name

0 commit comments

Comments
 (0)