UNPKG

dangerjs-wrapper

Version:

Plugin to Apply cultural rules during your CI process.

17 lines (16 loc) 712 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.checkUpdatedTests = void 0; const checkUpdatedTests = (dangerConfig) => { const { testFilesRegExp } = dangerConfig; const defaultTestFileRegExp = /(test|spec).(js|jsx|ts|tsx)/g; const addedFiles = danger.git.created_files || []; const changedFiles = danger.git.modified_files || []; const testFilesUpdated = [...addedFiles, ...changedFiles].filter(filepath => filepath.match(testFilesRegExp || defaultTestFileRegExp)); if (testFilesUpdated.length === 0) { warn('There are no changes in test files'); return false; } return true; }; exports.checkUpdatedTests = checkUpdatedTests;