mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-07 20:39:31 +08:00
This CL tidies up some leftover TODOs that we can now safely do now we have fully migrated to run_test_suite.js. Bug: chromium:1186163 Change-Id: I87a7e6052934e7ae0a4c5758dae2229703362242 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3075197 Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
30 lines
926 B
JavaScript
30 lines
926 B
JavaScript
// Copyright 2021 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
function getTestRunnerConfig() {
|
|
try {
|
|
return JSON.parse(process.env.TEST_RUNNER_JSON_CONFIG);
|
|
} catch {
|
|
// Return an empty object so any lookups return undefined
|
|
return {};
|
|
}
|
|
}
|
|
function getTestRunnerConfigSetting(settingKey, fallbackValue) {
|
|
const config = getTestRunnerConfig();
|
|
return config[settingKey] === undefined ? fallbackValue : config[settingKey];
|
|
}
|
|
function requireTestRunnerConfigSetting(settingKey, errorMessage) {
|
|
const config = getTestRunnerConfig();
|
|
if (config[settingKey] === undefined) {
|
|
throw new Error(errorMessage || `Test runner error: could not find required setting ${settingKey}`);
|
|
}
|
|
|
|
return config[settingKey];
|
|
}
|
|
|
|
module.exports = {
|
|
getTestRunnerConfigSetting,
|
|
requireTestRunnerConfigSetting
|
|
};
|