Files
react-native-devtools-frontend/scripts/test/test_config_helpers.js
T
Jack Franklin 2c388ffbc6 Remove legacy run_test_suite.py code
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>
2021-08-06 10:16:46 +00:00

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
};