Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function initDefaultOptions(state) {
defaultOptions = {};
const comment = state.file.ast.comments[0];
const docblock = (comment && comment.value) || '';
const fbtDocblockOptions = parseDocblock(docblock).fbt;
if (fbtDocblockOptions) {
defaultOptions = JSON.parse(fbtDocblockOptions);
Object.keys(defaultOptions).forEach(o => checkOption(o, ValidFbtOptions));
}
if (!defaultOptions.project) {
defaultOptions.project = '';
}
}
function initDefaultOptions(state) {
defaultOptions = {};
const comment = state.file.ast.comments[0];
const docblock = (comment && comment.value) || '';
const fbtDocblockOptions = parseDocblock(docblock).fbt;
if (fbtDocblockOptions) {
defaultOptions = JSON.parse(fbtDocblockOptions);
Object.keys(defaultOptions).forEach(o => checkOption(o, ValidFbtOptions));
}
if (!defaultOptions.project) {
defaultOptions.project = '';
}
}
module.exports = async function(testFiles, results, testVariables) {
if (testVariables.hasOwnProperty('ALERT')) {
if (testVariables.ALERT && results.numFailedTests > 0) {
for (const testFile of Object.keys(testFiles)) {
const testContents = testFiles[testFile]
const testMetaData = parse(testContents)
await sendSlackMessage(
results,
testFile,
testMetaData,
testVariables,
)
}
}
}
}