-
Notifications
You must be signed in to change notification settings - Fork 124
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
test: run Node.js 16 tests case #551
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Node.js 16 CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '16.x' | ||
- run: npm install | ||
- run: npm run prepublishOnly | ||
- run: node -v | ||
- run: npm run test-node16 | ||
Comment on lines
+1
to
+23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider adding error handling for the test script The workflow should handle potential failures in individual example files: name: Node.js 16 CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
+ cache: 'npm'
- run: npm install
- run: npm run prepublishOnly
- run: node -v
- - run: npm run test-node16
+ - name: Run Node.js 16 tests
+ run: |
+ set -e
+ for example in httpclient.cjs search_github.cjs timing.cjs; do
+ echo "Running $example..."
+ node "examples/$example"
+ done This change:
🧰 Tools🪛 yamllint (1.35.1)[error] 23-23: trailing spaces (trailing-spaces) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,7 @@ | |
"test-tsc:esm": "cd test/fixtures/ts-esm && rm -rf node_modules && npm link ../../.. && npm run build", | ||
"test": "npm run lint && vitest run", | ||
"test-keepalive": "cross-env TEST_KEEPALIVE_COUNT=50 vitest run --test-timeout 180000 keep-alive-header.test.ts", | ||
"test-node16": "node examples/httpclient.cjs && node examples/search_github.cjs && node examples/timing.cjs", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Remove test-node16 script as it's incompatible with package requirements The test-node16 script should be removed because:
🔗 Analysis chainVersion compatibility concern The package.json specifies Let's verify if the example files exist and check their Node.js version compatibility: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check if the example files exist and look for any version-specific code
echo "Checking example files existence and content:"
for file in examples/httpclient.cjs examples/search_github.cjs examples/timing.cjs; do
if [ -f "$file" ]; then
echo "Found $file"
# Look for potential version-specific features
rg -i "node:|requires|version" "$file"
else
echo "Missing $file"
fi
done
Length of output: 840 Script: #!/bin/bash
# Let's examine the content of these files to check for Node.js version-specific features
echo "=== httpclient.cjs ==="
cat examples/httpclient.cjs
echo -e "\n=== search_github.cjs ==="
cat examples/search_github.cjs
echo -e "\n=== timing.cjs ==="
cat examples/timing.cjs
# Also check package.json for any version-related context
echo -e "\n=== package.json engines and scripts ==="
cat package.json | rg -A 5 '"(engines|scripts)":'
Length of output: 3177 |
||
"cov": "vitest run --coverage", | ||
"ci": "npm run lint && npm run cov && npm run prepublishOnly && npm pack && attw --pack", | ||
"clean": "rm -rf dist", | ||
|
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.
💡 Codebase verification
Node.js 16 is not compatible with this package
The package explicitly requires Node.js >= 18.19.0 in its package.json
engines
field. Additionally, the build script uses Node.js 18+ features likenode:fs/promises
andnode:path
imports. Running the build in Node.js 16 environment will fail."node": ">= 18.19.0"
🔗 Analysis chain
Verify build compatibility with Node.js 16
The
prepublishOnly
script runs the build process which might use Node.js 18+ features. This could cause the workflow to fail.Let's check the build scripts for version-specific features:
Let me check the content of the script and package.json to better understand the build requirements.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 132
Script:
Length of output: 2883