mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
build: update script
This commit is contained in:
parent
91b9bb1ea1
commit
4c88aeabaf
9
.github/scripts/check-tests.mjs
vendored
9
.github/scripts/check-tests.mjs
vendored
|
@ -41,9 +41,9 @@ const hasFunctionOrClass = async filePath => {
|
||||||
return hasFunctionOrClass;
|
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')
|
const changedFiles = await execAsync('git diff --name-only --diff-filter=d origin/master..HEAD')
|
||||||
.then(({stdout}) => stdout.trim().split('\n').filter(Boolean));
|
.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 specAndTestTsFiles = await glob('packages/*/**/{test,__tests__}/*.{spec,test}.ts');
|
||||||
const specAndTestTsFilesNames = specAndTestTsFiles.map(file => path.parse(file).name.replace(/\.(test|spec)/, ''));
|
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'));
|
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(
|
const changedTsFilesWithFunction = await filterAsync(
|
||||||
async filePath =>
|
async filePath =>
|
||||||
filePath.endsWith('.ts') &&
|
filePath.endsWith('.ts') &&
|
||||||
|
@ -72,4 +73,4 @@ const program = async () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
program();
|
main();
|
||||||
|
|
Loading…
Reference in a new issue