Skip to content

Commit a8eb58c

Browse files
authored
fix globby (#3264)
* fix globby * bump node * fix: preserve test exit code and ensure junit artifact is always uploaded * fix: exclude dotfiles from yaml test file discovery * fix: disable coverage in integration test tap run * fix: use --disable-coverage flag for tap integration test run * fix: allow incomplete coverage in integration tests
1 parent ce00241 commit a8eb58c

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

.buildkite/run-client.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ script_path=$(dirname "$(realpath -s "$0")")
66
set -euo pipefail
77
repo=$(pwd)
88

9-
export NODE_VERSION=${NODE_VERSION:-20}
9+
export NODE_VERSION=${NODE_VERSION:-22}
1010

1111
echo "--- :javascript: Building Docker image"
1212
docker build \
@@ -35,4 +35,9 @@ docker run \
3535
--name elasticsearch-js \
3636
--rm \
3737
elastic/elasticsearch-js \
38-
bash -c "npm run test:integration; [ -f ./report-junit.xml ] && mv ./report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'"
38+
bash -c "npm run test:integration; TEST_EXIT=\$?; [ -f ./report-junit.xml ] && mv ./report-junit.xml /junit-output/junit-$BUILDKITE_JOB_ID.xml || echo 'No JUnit artifact found'; exit \$TEST_EXIT"
39+
40+
if [ ! -f "$repo/junit-output/junit-$BUILDKITE_JOB_ID.xml" ]; then
41+
echo "No JUnit artifact produced, creating empty placeholder"
42+
echo '<?xml version="1.0" encoding="UTF-8"?><testsuites></testsuites>' > "$repo/junit-output/junit-$BUILDKITE_JOB_ID.xml"
43+
fi

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"test:coverage-report": "npm run build && tap --coverage && nyc report --reporter=text-lcov > coverage.lcov",
3535
"test:coverage-ui": "npm run build && tap --coverage --coverage-report=html",
3636
"test:integration-build": "npm run build && node test/integration/index.js",
37-
"test:integration": "npm run test:integration-build && env tap run --jobs=1 --reporter=junit --reporter-file=report-junit.xml generated-tests/",
37+
"test:integration": "npm run test:integration-build && env tap run --jobs=1 --allow-empty-coverage --allow-incomplete-coverage --reporter=junit --reporter-file=report-junit.xml generated-tests/",
3838
"lint": "eslint",
3939
"lint:fix": "eslint . --fix ",
4040
"license-checker": "license-checker --production --onlyAllow='MIT;Apache-2.0;Apache1.1;ISC;BSD-3-Clause;BSD-2-Clause;0BSD'",
@@ -75,7 +75,7 @@
7575
},
7676
"homepage": "http://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
7777
"engines": {
78-
"node": ">=20"
78+
"node": ">=22"
7979
},
8080
"devDependencies": {
8181
"@elastic/request-converter": "9.3.0",

test/integration/index.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const assert = require('node:assert')
1414
const url = require('node:url')
1515
const fs = require('node:fs')
1616
const path = require('node:path')
17-
const globby = require('globby')
1817
const semver = require('semver')
1918

2019
const buildTests = require('./test-builder')
@@ -31,12 +30,12 @@ async function loadDownloadArtifacts () {
3130
}
3231

3332
const getAllFiles = async dir => {
34-
const files = await globby(dir, {
35-
expandDirectories: {
36-
extensions: ['yml', 'yaml']
37-
}
38-
})
39-
return files.sort()
33+
const entries = await fs.promises.readdir(dir, { recursive: true })
34+
return entries
35+
.filter(f => f.endsWith('.yml') || f.endsWith('.yaml'))
36+
.filter(f => !f.split(path.sep).some(part => part.startsWith('.')))
37+
.map(f => path.join(dir, f))
38+
.sort()
4039
}
4140

4241
async function doTestBuilder (version, clientOptions) {

0 commit comments

Comments
 (0)