Skip to content

Commit de33c70

Browse files
committed
1480: clarifications/renamings
1 parent 64b201b commit de33c70

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

lib/src/main/java/com/diffplug/spotless/npm/ShadowCopy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ public ShadowCopy(@Nonnull File shadowCopyRoot) {
4949
}
5050

5151
public void addEntry(String key, File orig) {
52+
// prevent concurrent adding of entry with same key
5253
if (!reserveSubFolder(key)) {
53-
logger.debug("Shadow copy entry already on the way: {}. Awaiting finalization.", key);
54+
logger.debug("Shadow copy entry already in progress: {}. Awaiting finalization.", key);
5455
try {
55-
// maybe make the duration configurable?
5656
NpmResourceHelper.awaitFileDeleted(markerFilePath(key).toFile(), Duration.ofSeconds(120));
5757
} catch (TimeoutException e) {
5858
throw new RuntimeException(e);

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

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static void beforeAll(@TempDir File pertainingCacheDir) {
4747
}
4848

4949
@Test
50-
void prettierWithDefaultInstallCacheTest() throws IOException {
50+
void prettierCachesNodeModulesToADefaultFolderWhenCachingEnabled() throws IOException {
5151
File dir1 = newFolder("npm-prettier-1");
5252
File cacheDir = DEFAULT_DIR_FOR_NPM_INSTALL_CACHE_DO_NEVER_WRITE_TO_THIS;
5353
BuildResult result = runPhpPrettierOnDir(dir1, cacheDir);
@@ -59,7 +59,7 @@ void prettierWithDefaultInstallCacheTest() throws IOException {
5959
}
6060

6161
@Test
62-
void prettierWithSpecificInstallCacheTest() throws IOException {
62+
void prettierCachesAndReusesNodeModulesInSpecificInstallCacheFolder() throws IOException {
6363
File dir1 = newFolder("npm-prettier-1");
6464
File cacheDir = newFolder("npm-prettier-cache");
6565
BuildResult result = runPhpPrettierOnDir(dir1, cacheDir);
@@ -70,18 +70,17 @@ void prettierWithSpecificInstallCacheTest() throws IOException {
7070
}
7171

7272
@Test
73-
void prettierWithNoCacheTest() throws IOException {
73+
void prettierDoesNotCacheNodeModulesIfNotExplicitlyEnabled() throws IOException {
7474
File dir2 = newFolder("npm-prettier-1");
75-
File cacheDir = null;
76-
BuildResult result = runPhpPrettierOnDir(dir2, cacheDir);
75+
BuildResult result = runPhpPrettierOnDir(dir2, null);
7776
Assertions.assertThat(result.getOutput())
7877
.doesNotContainPattern("Using cached node_modules for .*")
7978
.doesNotContainPattern("Caching node_modules for .*");
8079
}
8180

8281
@Test
8382
@Order(1)
84-
void prettierWithSpecificGlobalInstallCacheTest() throws IOException {
83+
void prettierCachesNodeModuleInGlobalInstallCacheDir() throws IOException {
8584
File dir1 = newFolder("npm-prettier-global-1");
8685
File cacheDir = pertainingCacheDir;
8786
BuildResult result = runPhpPrettierOnDir(dir1, cacheDir);
@@ -92,7 +91,7 @@ void prettierWithSpecificGlobalInstallCacheTest() throws IOException {
9291

9392
@Test
9493
@Order(2)
95-
void prettierWithSpecificGlobalInstallCacheTest2() throws IOException {
94+
void prettierUsesCachedNodeModulesFromGlobalInstallCacheDir() throws IOException {
9695
File dir2 = newFolder("npm-prettier-global-2");
9796
File cacheDir = pertainingCacheDir;
9897
BuildResult result = runPhpPrettierOnDir(dir2, cacheDir);
@@ -130,7 +129,7 @@ private BuildResult runPhpPrettierOnDir(File projDir, File cacheDir) throws IOEx
130129

131130
@Test
132131
@Order(3)
133-
void tsfmtWithSpecificGlobalInstallCacheTest() throws IOException {
132+
void tsfmtCachesNodeModuleInGlobalInstallCacheDir() throws IOException {
134133
File dir1 = newFolder("npm-tsfmt-global-1");
135134
File cacheDir = pertainingCacheDir;
136135
BuildResult result = runTsfmtOnDir(dir1, cacheDir);
@@ -141,7 +140,7 @@ void tsfmtWithSpecificGlobalInstallCacheTest() throws IOException {
141140

142141
@Test
143142
@Order(4)
144-
void tsfmtWithSpecificGlobalInstallCacheTest2() throws IOException {
143+
void tsfmtUsesCachedNodeModulesFromGlobalInstallCacheDir() throws IOException {
145144
File dir2 = newFolder("npm-tsfmt-global-2");
146145
File cacheDir = pertainingCacheDir;
147146
BuildResult result = runTsfmtOnDir(dir2, cacheDir);
@@ -151,10 +150,9 @@ void tsfmtWithSpecificGlobalInstallCacheTest2() throws IOException {
151150
}
152151

153152
@Test
154-
void tsfmtWithNoCacheTest() throws IOException {
153+
void tsfmtDoesNotCacheNodeModulesIfNotExplicitlyEnabled() throws IOException {
155154
File dir2 = newFolder("npm-tsfmt-1");
156-
File cacheDir = null;
157-
BuildResult result = runTsfmtOnDir(dir2, cacheDir);
155+
BuildResult result = runTsfmtOnDir(dir2, null);
158156
Assertions.assertThat(result.getOutput())
159157
.doesNotContainPattern("Using cached node_modules for .*")
160158
.doesNotContainPattern("Caching node_modules for .*");
@@ -185,7 +183,7 @@ private BuildResult runTsfmtOnDir(File projDir, File cacheDir) throws IOExceptio
185183

186184
@Test
187185
@Order(5)
188-
void eslintWithSpecificGlobalInstallCacheTest() throws IOException {
186+
void eslintCachesNodeModuleInGlobalInstallCacheDir() throws IOException {
189187
File dir1 = newFolder("npm-eslint-global-1");
190188
File cacheDir = pertainingCacheDir;
191189
BuildResult result = runEslintOnDir(dir1, cacheDir);
@@ -196,7 +194,7 @@ void eslintWithSpecificGlobalInstallCacheTest() throws IOException {
196194

197195
@Test
198196
@Order(6)
199-
void eslintWithSpecificGlobalInstallCacheTest2() throws IOException {
197+
void eslintUsesCachedNodeModulesFromGlobalInstallCacheDir() throws IOException {
200198
File dir2 = newFolder("npm-eslint-global-2");
201199
File cacheDir = pertainingCacheDir;
202200
BuildResult result = runEslintOnDir(dir2, cacheDir);
@@ -206,7 +204,7 @@ void eslintWithSpecificGlobalInstallCacheTest2() throws IOException {
206204
}
207205

208206
@Test
209-
void eslintWithNoCacheTest() throws IOException {
207+
void eslintDoesNotCacheNodeModulesIfNotExplicitlyEnabled() throws IOException {
210208
File dir2 = newFolder("npm-eslint-1");
211209
File cacheDir = null;
212210
BuildResult result = runEslintOnDir(dir2, cacheDir);

0 commit comments

Comments
 (0)