From 2b2dbcdd679a5a38dba9450c564a0a3242182aeb Mon Sep 17 00:00:00 2001 From: Wil Wilsman Date: Thu, 25 Mar 2021 17:07:56 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20@percy/logger=20test=20hel?= =?UTF-8?q?per=20unsupported=20syntax=20(#266)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🔨 Use babel overrides to exclude files from presets and plugins * 🐛 Fix distributed logger test helpers unsupported syntax --- babel.config.js | 31 +++++++++++++++++++------------ packages/logger/test/helpers.js | 2 +- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/babel.config.js b/babel.config.js index 91d229ff4..f3c6a06e1 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,17 +1,24 @@ -const pkg = require(`${process.cwd()}/package.json`); +const cwd = process.cwd(); +const path = require('path'); +const pkg = require(`${cwd}/package.json`); const base = { - ignore: pkg.files, - presets: [ - ['@babel/env', { - targets: { - node: '12' - } - }] - ], - plugins: [ - '@babel/proposal-class-properties' - ] + overrides: [{ + exclude: pkg.files && ( + pkg.files.map(f => ( + path.join(cwd, f) + ))), + presets: [ + ['@babel/env', { + targets: { + node: '12' + } + }] + ], + plugins: [ + '@babel/proposal-class-properties' + ] + }] }; const development = { diff --git a/packages/logger/test/helpers.js b/packages/logger/test/helpers.js index 466d192ec..44e744850 100644 --- a/packages/logger/test/helpers.js +++ b/packages/logger/test/helpers.js @@ -95,7 +95,7 @@ const helpers = { }, dump() { - if (!helpers.messages?.size) return; + if (!helpers.messages || !helpers.messages.size) return; if (console.log.and) console.log.and.callThrough(); let write = m => process.env.__PERCY_BROWSERIFIED__