From 8a85d220e2ea5b3283589e204a02456141d60fdf Mon Sep 17 00:00:00 2001 From: Mark Stacey Date: Mon, 19 Jun 2023 16:14:08 -0230 Subject: [PATCH] Fix `testDev` builds with LavaMoat enabled (#19506) * Fix `devTest` build that have LavaMoat enabled The build script compiles the LavaMoat runtime during each root task, but it was not recognizing `testDev` as a root task. As a result, all `testDev` builds were broken unless LavaMoat was disabled. The list of root tasks has been updated to include `testDev`. It should now be complete. * Use BUILD_TARGETS constant, and enable scuttling in start:test --- development/build/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/development/build/index.js b/development/build/index.js index b9d00698acee..c2fdf50959d6 100755 --- a/development/build/index.js +++ b/development/build/index.js @@ -14,7 +14,7 @@ const difference = require('lodash/difference'); const { intersection } = require('lodash'); const { getVersion } = require('../lib/get-version'); const { loadBuildTypesConfig } = require('../lib/build-type'); -const { TASKS } = require('./constants'); +const { BUILD_TARGETS, TASKS } = require('./constants'); const { createTask, composeSeries, @@ -28,7 +28,6 @@ const createStaticAssetTasks = require('./static'); const createEtcTasks = require('./etc'); const { getBrowserVersionMap, getEnvironment } = require('./utils'); const { getConfig } = require('./config'); -const { BUILD_TARGETS } = require('./constants'); // Packages required dynamically via browserify configuration in dependencies // Required for LavaMoat policy generation @@ -76,11 +75,11 @@ async function defineAndRunBuildTasks() { platform, } = await parseArgv(); - const isRootTask = ['dist', 'prod', 'test', 'dev'].includes(entryTask); + const isRootTask = Object.values(BUILD_TARGETS).includes(entryTask); if (isRootTask) { // scuttle on production/tests environment only - const shouldScuttle = ['dist', 'prod', 'test'].includes(entryTask); + const shouldScuttle = entryTask !== BUILD_TARGETS.DEV; console.log( `Building lavamoat runtime file`,