diff --git a/index.js b/index.js index eca4ee6..cd895dc 100644 --- a/index.js +++ b/index.js @@ -92,4 +92,15 @@ export const onPreBuild = async ({ console.log(` Done.`); }; -export const onPreDev = onPreBuild; +export const onPreDev = async ({ inputs, netlifyConfig, utils, constants }) => { + if (!process.env.RUN_NETLIFY_CSP_NONCE_PLUGIN_TESTS) { + return; + } + + return onPreBuild({ + inputs, + netlifyConfig, + utils, + constants, + }); +}; diff --git a/tests/integration/helpers.ts b/tests/integration/helpers.ts index 50f55a0..01cc76e 100644 --- a/tests/integration/helpers.ts +++ b/tests/integration/helpers.ts @@ -30,6 +30,7 @@ export const serve = async ({ const proc = execa(...command(port), { all: true, cancelSignal: abortController.signal, + env: { RUN_NETLIFY_CSP_NONCE_PLUGIN_TESTS: "1" }, }); await new Promise((resolve) => {