From 4c88aeabafb0eb011dfaa2870d1c34bd64dcab01 Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Mon, 19 Jun 2023 11:15:28 +0200 Subject: [PATCH] build: update script --- .github/scripts/check-tests.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/scripts/check-tests.mjs b/.github/scripts/check-tests.mjs index 301ceb6ccb..4ab8cb0f64 100644 --- a/.github/scripts/check-tests.mjs +++ b/.github/scripts/check-tests.mjs @@ -41,9 +41,9 @@ const hasFunctionOrClass = async filePath => { return hasFunctionOrClass; } -const program = async () => { +const main = async () => { - // Run a git command to get a list of all files in the commit + // Run a git command to get a list of all changed files in the branch (branch has to be up to date with master) const changedFiles = await execAsync('git diff --name-only --diff-filter=d origin/master..HEAD') .then(({stdout}) => stdout.trim().split('\n').filter(Boolean)); @@ -51,8 +51,9 @@ const program = async () => { const specAndTestTsFiles = await glob('packages/*/**/{test,__tests__}/*.{spec,test}.ts'); const specAndTestTsFilesNames = specAndTestTsFiles.map(file => path.parse(file).name.replace(/\.(test|spec)/, '')); - // Filter out the .ts and .vue files from the changed files, .ts files with any kind of function declaration or class + // Filter out the .ts and .vue files from the changed files const changedVueFiles = changedFiles.filter(file => file.endsWith('.vue')); + // .ts files with any kind of function declaration or class and not in any of the test folders const changedTsFilesWithFunction = await filterAsync( async filePath => filePath.endsWith('.ts') && @@ -72,4 +73,4 @@ const program = async () => { }); }; -program(); +main();