Skip to content

Commit e12c5ef

Browse files
committed
eslint: speedup npmrc tests
we intend them to timeout, but please fail quicker.
1 parent cb3dd55 commit e12c5ef

File tree

3 files changed

+31
-9
lines changed

3 files changed

+31
-9
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2022 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -163,7 +163,10 @@ void usePhpCommunityPlugin() throws IOException {
163163
@Test
164164
void autodetectNpmrcFileConfig() throws IOException {
165165
setFile(".npmrc").toLines(
166-
"registry=https://i.do.no.exist.com");
166+
"registry=https://i.do.not.exist.com",
167+
"fetch-timeout=250",
168+
"fetch-retry-mintimeout=250",
169+
"fetch-retry-maxtimeout=250");
167170
setFile("build.gradle").toLines(
168171
"plugins {",
169172
" id 'com.diffplug.spotless'",
@@ -186,7 +189,10 @@ void autodetectNpmrcFileConfig() throws IOException {
186189
@Test
187190
void pickupNpmrcFileConfig() throws IOException {
188191
setFile(".custom_npmrc").toLines(
189-
"registry=https://i.do.no.exist.com");
192+
"registry=https://i.do.not.exist.com",
193+
"fetch-timeout=250",
194+
"fetch-retry-mintimeout=250",
195+
"fetch-retry-maxtimeout=250");
190196
setFile("build.gradle").toLines(
191197
"plugins {",
192198
" id 'com.diffplug.spotless'",

plugin-maven/src/test/java/com/diffplug/spotless/maven/prettier/PrettierFormatStepTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2022 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -145,7 +145,11 @@ void autodetect_parser_based_on_filename() throws Exception {
145145

146146
@Test
147147
void autodetect_npmrc_file() throws Exception {
148-
setFile(".npmrc").toLines("registry=https://i.do.no.exist.com");
148+
setFile(".npmrc").toLines(
149+
"registry=https://i.do.not.exist.com",
150+
"fetch-timeout=250",
151+
"fetch-retry-mintimeout=250",
152+
"fetch-retry-maxtimeout=250");
149153
String suffix = "ts";
150154
writePomWithPrettierSteps("**/*." + suffix,
151155
"<prettier>",
@@ -158,7 +162,11 @@ void autodetect_npmrc_file() throws Exception {
158162

159163
@Test
160164
void select_configured_npmrc_file() throws Exception {
161-
setFile(".custom_npmrc").toLines("registry=https://i.do.no.exist.com");
165+
setFile(".custom_npmrc").toLines(
166+
"registry=https://i.do.not.exist.com",
167+
"fetch-timeout=250",
168+
"fetch-retry-mintimeout=250",
169+
"fetch-retry-maxtimeout=250");
162170
String suffix = "ts";
163171
writePomWithPrettierSteps("**/*." + suffix,
164172
"<prettier>",

plugin-maven/src/test/java/com/diffplug/spotless/maven/typescript/TypescriptFormatStepTest.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 DiffPlug
2+
* Copyright 2016-2022 DiffPlug
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -114,7 +114,11 @@ void testTypescript_2_Configs() throws Exception {
114114

115115
@Test
116116
void testNpmrcIsAutoPickedUp() throws Exception {
117-
setFile(".npmrc").toLines("registry=https://i.do.no.exist.com");
117+
setFile(".npmrc").toLines(
118+
"registry=https://i.do.not.exist.com",
119+
"fetch-timeout=250",
120+
"fetch-retry-mintimeout=250",
121+
"fetch-retry-maxtimeout=250");
118122
writePomWithTypescriptSteps(
119123
"<tsfmt>",
120124
" <tslintFile>${basedir}/tslint.json</tslintFile>",
@@ -126,7 +130,11 @@ void testNpmrcIsAutoPickedUp() throws Exception {
126130

127131
@Test
128132
void testNpmrcIsConfigurativelyPickedUp() throws Exception {
129-
setFile(".custom_npmrc").toLines("registry=https://i.do.no.exist.com");
133+
setFile(".custom_npmrc").toLines(
134+
"registry=https://i.do.not.exist.com",
135+
"fetch-timeout=250",
136+
"fetch-retry-mintimeout=250",
137+
"fetch-retry-maxtimeout=250");
130138
writePomWithTypescriptSteps(
131139
"<tsfmt>",
132140
" <tslintFile>${basedir}/tslint.json</tslintFile>",

0 commit comments

Comments
 (0)