Bug 1661671 - Add plugin to support optional chaining operator in unit tests r=k88hudson

Differential Revision: https://phabricator.services.mozilla.com/D88581
This commit is contained in:
Andrei Oprea 2020-09-08 13:31:04 +00:00
Родитель 188dcede21
Коммит 1ee5cbc410
5 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -238,7 +238,7 @@ class AboutWelcomeChild extends JSWindowActorChild {
Cu.reportError(e);
}
if (experimentData && experimentData.slug) {
if (experimentData?.slug) {
log.debug(
`Loading about:welcome with experiment: ${experimentData.slug}`
);

Просмотреть файл

@ -224,9 +224,9 @@ async function mount() {
slug,
branch
} = await window.AWGetStartupData();
let settings = branch && branch.feature ? branch.feature.value : {};
let settings = (branch === null || branch === void 0 ? void 0 : branch.feature) ? branch.feature.value : {};
if (!(branch && branch.feature)) {
if (!(branch === null || branch === void 0 ? void 0 : branch.feature)) {
// Check for override content in pref browser.aboutwelcome.overrideContent
settings = await window.AWGetMultiStageScreens();
}

Просмотреть файл

@ -117,9 +117,9 @@ function ComputeMessageId(experimentId, branchId, settings) {
async function mount() {
const { slug, branch } = await window.AWGetStartupData();
let settings = branch && branch.feature ? branch.feature.value : {};
let settings = branch?.feature ? branch.feature.value : {};
if (!(branch && branch.feature)) {
if (!branch?.feature) {
// Check for override content in pref browser.aboutwelcome.overrideContent
settings = await window.AWGetMultiStageScreens();
}

Просмотреть файл

@ -362,11 +362,7 @@ const MessageLoaderUtils = {
continue;
}
if (
experimentData &&
experimentData.branch &&
experimentData.branch.feature
) {
if (experimentData?.branch?.feature) {
experiments.push(experimentData.branch.feature.value);
if (!REACH_EVENT_GROUPS.includes(featureId)) {

Просмотреть файл

@ -33,6 +33,7 @@ module.exports = (env = {}) => ({
loader: "babel-loader",
options: {
presets: ["@babel/preset-react"],
plugins: ["@babel/plugin-proposal-optional-chaining"],
},
},
{