-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Batch building/compiling tests #2558
Conversation
@pokey Appears that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow this is some serious bash-foo. guessing chatgpt helped you here? 😅
looks like you'll need a different trick on mac tho; see CI 😕 |
hmm not sure. seems slightly strange to install new bash and overwrite default one. here's what chatgpt suggests: #!/usr/bin/env bash
set -euo pipefail
# Initialize an empty array to hold the test files
TESTS=()
# Read the output of the find command into the TESTS array
while IFS= read -r file; do
TESTS+=("$file")
done < <(find .. -name '*.test.ts')
BATCH_SIZE=50
SIZE=${#TESTS[@]}
for ((i = 0; i < SIZE; i += BATCH_SIZE)); do
BATCH=("${TESTS[@]:i:BATCH_SIZE}")
pnpm run build:base --outdir=dist --out-extension:.js=.cjs "${BATCH[@]}"
done But I don't feel strongly; probably fine to use that bash upgrade trick? |
alternately, you could rewrite it in typescript so it can be read by humans? 😅 |
Maybe :D |
Using esbuild js api? I'm general for that, but then I think we should probably switch all our esbuild to that and that should probably be a separate pull request. I will try the suggestion above first. |
actually i think #!/usr/bin/env bash
set -euo pipefail
find .. -name '*.test.ts' | xargs -n 50 pnpm run build:base --outdir=dist --out-extension:.js=.cjs |
Oh xargs was one of the things I tested first, but I couldn't get it to work. I must have done something weird because this looks fine :) |
We have to many tests in to many packages now. On windows I get
The commandline is too long
. Solving this by batching 50 tests at the time.Checklist