From c409d4e48acec3697d910099154bf4d8ca04cd12 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 1 Feb 2021 15:24:06 +0100 Subject: [PATCH 1/2] Cache built manager but don't use or clear any cache when running smoke test --- lib/core/src/server/dev-server.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/core/src/server/dev-server.ts b/lib/core/src/server/dev-server.ts index 536e32ccb2b2..abc5ecc2375d 100644 --- a/lib/core/src/server/dev-server.ts +++ b/lib/core/src/server/dev-server.ts @@ -237,18 +237,18 @@ const startManager = async ({ logConfig('Manager webpack config', managerConfig); } - if (options.cache && !options.smokeTest) { + if (options.cache) { if (options.managerCache) { const [useCache, hasOutput] = await Promise.all([ // must run even if outputDir doesn't exist, otherwise the 2nd run won't use cache useManagerCache(options.cache, managerConfig), pathExists(outputDir), ]); - if (useCache && hasOutput) { + if (useCache && hasOutput && !options.smokeTest) { logger.info('=> Using cached manager'); managerConfig = null; } - } else if (await clearManagerCache(options.cache)) { + } else if (!options.smokeTest && (await clearManagerCache(options.cache))) { logger.info('=> Cleared cached manager config'); } } From aa74cb587d96b1a2c0b9ced4c75af223eb0a6d6a Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Mon, 1 Feb 2021 16:04:54 +0100 Subject: [PATCH 2/2] Don't open browser when running smoke test --- lib/core/src/server/dev-server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/core/src/server/dev-server.ts b/lib/core/src/server/dev-server.ts index abc5ecc2375d..252feb0997bd 100644 --- a/lib/core/src/server/dev-server.ts +++ b/lib/core/src/server/dev-server.ts @@ -413,14 +413,14 @@ export async function storybookDevServer(options: any) { startManager({ startTime, options, configType, outputDir, configDir, prebuiltDir }) // TODO #13083 Restore this when compiling the preview is fast enough // .then((result) => { - // if (!options.ci) openInBrowser(address); + // if (!options.ci && !options.smokeTest) openInBrowser(address); // return result; // }) .catch(bailPreview), ]); // TODO #13083 Remove this when compiling the preview is fast enough - if (!options.ci) openInBrowser(networkAddress); + if (!options.ci && !options.smokeTest) openInBrowser(networkAddress); return { ...previewResult, ...managerResult, address, networkAddress }; }