From f64a639bcfa1fc2bc89ca7db268f594306edfd7c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 16 Mar 2021 18:18:33 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-10-stable-ee --- scripts/frontend/file_test_coverage.js | 44 +++++++++++++++++----------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'scripts/frontend/file_test_coverage.js') diff --git a/scripts/frontend/file_test_coverage.js b/scripts/frontend/file_test_coverage.js index ec6ec4a1e9d..04a9035fce2 100755 --- a/scripts/frontend/file_test_coverage.js +++ b/scripts/frontend/file_test_coverage.js @@ -31,28 +31,6 @@ let numTestFiles = 0; const isVerbose = process.argv.some((arg) => arg === '-v'); -const countSourceFiles = (path) => - forEachFileIn(path, (fileName) => { - if (fileName.endsWith('.vue') || fileName.endsWith('.js')) { - if (isVerbose) { - console.log(`source file: ${fileName}`); - } - - numSourceFiles += 1; - } - }); - -const countTestFiles = (path) => - forEachFileIn(path, (fileName) => { - if (fileName.endsWith('_spec.js')) { - if (isVerbose) { - console.log(`test file: ${fileName}`); - } - - numTestFiles += 1; - } - }); - function forEachFileIn(dirPath, callback) { fs.readdir(dirPath, (err, files) => { if (err) { @@ -75,6 +53,28 @@ function forEachFileIn(dirPath, callback) { }); } +const countSourceFiles = (currentPath) => + forEachFileIn(currentPath, (fileName) => { + if (fileName.endsWith('.vue') || fileName.endsWith('.js')) { + if (isVerbose) { + console.log(`source file: ${fileName}`); + } + + numSourceFiles += 1; + } + }); + +const countTestFiles = (currentPath) => + forEachFileIn(currentPath, (fileName) => { + if (fileName.endsWith('_spec.js')) { + if (isVerbose) { + console.log(`test file: ${fileName}`); + } + + numTestFiles += 1; + } + }); + console.log(`Source directories: ${sourceDirectories.join(', ')}`); console.log(`Test directories: ${testDirectories.join(', ')}`); -- cgit v1.2.1