diff --git a/packages/cli/babel/index.js b/packages/cli/babel/index.js index 6d54506f8..6fff82da7 100644 --- a/packages/cli/babel/index.js +++ b/packages/cli/babel/index.js @@ -21,7 +21,7 @@ var defaultBrowserListDev = [ 'ios_saf >= 10.3', 'edge >= 16', 'opera >= 48', - 'samsung >= 8.2' + 'samsung >= 8.2', ]; // preact-cli babel configs diff --git a/packages/cli/sw/contants.js b/packages/cli/sw/constants.js similarity index 100% rename from packages/cli/sw/contants.js rename to packages/cli/sw/constants.js diff --git a/packages/cli/sw/index.js b/packages/cli/sw/index.js index 52259f9ae..da325d51f 100644 --- a/packages/cli/sw/index.js +++ b/packages/cli/sw/index.js @@ -1,7 +1,7 @@ import { registerRoute, setCatchHandler } from 'workbox-routing'; import { precacheAndRoute, getCacheKeyForURL } from 'workbox-precaching'; import { isNav } from './utils'; -import { NETWORK_HANDLER, PRECACHING_OPTIONS } from './contants'; +import { NETWORK_HANDLER, PRECACHING_OPTIONS } from './constants'; export function getFiles() { return self.__WB_MANIFEST; diff --git a/packages/cli/tests/build.test.js b/packages/cli/tests/build.test.js index a2be5370b..0f49700e3 100644 --- a/packages/cli/tests/build.test.js +++ b/packages/cli/tests/build.test.js @@ -182,8 +182,10 @@ describe('preact build', () => { `${dir}/build/${bundleFile}`, 'utf8' ); + // "Hello World!" should replace 'process.env.PREACT_APP_MY_VARIABLE' - expect(transpiledChunk.includes('console.log("Hello World!")')).toBe(true); + expect(transpiledChunk.includes('"Hello World!"')).toBe(true); + expect(transpiledChunk.includes('PREACT_APP_MY_VARIABLE')).toBe(false); }); it('should respect `publicPath` value', async () => { diff --git a/packages/cli/tests/lib/chrome.js b/packages/cli/tests/lib/chrome.js index 1f9d34f9c..78230c37e 100644 --- a/packages/cli/tests/lib/chrome.js +++ b/packages/cli/tests/lib/chrome.js @@ -12,7 +12,7 @@ module.exports.waitUntilExpression = async function (page, expression) { `Waiting for ${expression}` ); - return result; // && result.value; + return result; }; await waitUntil(evaluate, `Waiting for ${expression} timed out!`); diff --git a/packages/cli/tests/lib/output.js b/packages/cli/tests/lib/output.js index ef06c185b..095054dbc 100644 --- a/packages/cli/tests/lib/output.js +++ b/packages/cli/tests/lib/output.js @@ -10,7 +10,7 @@ async function tmpDir() { let str = Math.random() .toString(36) .replace(/[^a-z]+/g, '') - .substr(0, 12); + .substring(0, 12); await mkdir(output, { recursive: true }); return resolve(output, str); } diff --git a/packages/cli/tests/subjects/custom-dotenv/index.js b/packages/cli/tests/subjects/custom-dotenv/index.js index 9e532391e..2681c31c6 100644 --- a/packages/cli/tests/subjects/custom-dotenv/index.js +++ b/packages/cli/tests/subjects/custom-dotenv/index.js @@ -1 +1 @@ -console.log(process.env.PREACT_APP_MY_VARIABLE); +export const MY_VARIABLE = process.env.PREACT_APP_MY_VARIABLE;