mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
build: fix gh workflow script
This commit is contained in:
parent
53fad99029
commit
61127c0f2b
10
.github/scripts/check-tests.mjs
vendored
10
.github/scripts/check-tests.mjs
vendored
|
@ -1,13 +1,13 @@
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import util from 'util';
|
import util from 'util';
|
||||||
import { exec } from 'child_process';
|
import { spawn } from 'child_process';
|
||||||
import { glob } from "glob";
|
import { glob } from "glob";
|
||||||
import parser from '@babel/parser';
|
import parser from '@babel/parser';
|
||||||
import traverse from '@babel/traverse';
|
import traverse from '@babel/traverse';
|
||||||
|
|
||||||
const readFileAsync = util.promisify(fs.readFile);
|
const readFileAsync = util.promisify(fs.readFile);
|
||||||
const execAsync = util.promisify(exec);
|
const spawnAsync = util.promisify(spawn);
|
||||||
|
|
||||||
const filterAsync = async (asyncPredicate, arr) => {
|
const filterAsync = async (asyncPredicate, arr) => {
|
||||||
const filterResults = await Promise.all(arr.map(async item => ({
|
const filterResults = await Promise.all(arr.map(async item => ({
|
||||||
|
@ -44,8 +44,10 @@ const hasFunctionOrClass = async filePath => {
|
||||||
const program = async () => {
|
const program = 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 files in the commit
|
||||||
const changedFilesCommand = "git diff --name-only --diff-filter=d origin/master...HEAD";
|
const changedFiles = await spawnAsync(
|
||||||
const changedFiles = await execAsync(changedFilesCommand).then(stdout => stdout.toString().trim().split('\n').filter(Boolean));
|
'git',
|
||||||
|
['diff', '--name-only', '--diff-filter=d', 'origin/master...HEAD']
|
||||||
|
).then(stdout => stdout.toString().trim().split('\n').filter(Boolean));
|
||||||
|
|
||||||
// Get all .spec.ts and .test.ts files from the packages
|
// Get all .spec.ts and .test.ts files from the packages
|
||||||
const specAndTestTsFiles = await glob('../../packages/*/**/{test,__tests__}/*.{spec,test}.ts');
|
const specAndTestTsFiles = await glob('../../packages/*/**/{test,__tests__}/*.{spec,test}.ts');
|
||||||
|
|
Loading…
Reference in a new issue