From 37ce03e4f10226f004788a86775419fb3536e04e Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Mon, 26 Aug 2024 14:52:46 -0500 Subject: [PATCH 1/8] Add experimental Bun test runner --- .github/workflows/nodejs.yml | 30 ++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 31 insertions(+) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e4765731f..7dbec6fb0 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -73,6 +73,36 @@ jobs: run: | npm run license-checker + test-bun: + name: Test Bun + runs-on: ${{ matrix.os }} + needs: paths-filter + # only run if code relevant to unit tests was changed + if: needs.paths-filter.outputs.src-only == 'true' + + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Use Bun + uses: oven-sh/setup-bun@v2 + + - name: Install + run: | + bun install + + - name: Lint + run: | + bun run lint + + - name: Unit test + run: | + bun run test:unit-bun + auto-approve: name: Auto-approve needs: [test, license] diff --git a/package.json b/package.json index 520ed4b04..dc8ccd2c9 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "scripts": { "test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts", "test:unit": "npm run build && tap test/unit/{*,**/*}.test.ts", + "test:unit-bun": "bunx tap test/unit/{*,**/*}.test.ts", "test:coverage-100": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --100", "test:coverage-report": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov", "test:coverage-ui": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --coverage-report=html", From fd6f0f8d75fd309257e6f66801896f799753f83c Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Tue, 27 Aug 2024 13:05:17 -0500 Subject: [PATCH 2/8] Add TypeScript export for Bun --- index.ts | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 index.ts diff --git a/index.ts b/index.ts new file mode 100644 index 000000000..0dac730c4 --- /dev/null +++ b/index.ts @@ -0,0 +1,53 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { + Diagnostic, + Transport, + WeightedConnectionPool, + ClusterConnectionPool, + BaseConnectionPool, + CloudConnectionPool, + BaseConnection, + HttpConnection, + UndiciConnection, + Serializer, + errors, + events +} from '@elastic/transport' + +import Client from './src/client' +import SniffingTransport from './src/sniffingTransport' + +export { + Client, + SniffingTransport, + Diagnostic, + Transport, + WeightedConnectionPool, + ClusterConnectionPool, + BaseConnectionPool, + CloudConnectionPool, + BaseConnection, + HttpConnection, + UndiciConnection, + Serializer, + errors, + events +} diff --git a/package.json b/package.json index dc8ccd2c9..7675e6d5f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "main": "./index.js", "types": "index.d.ts", "exports": { - "require": "./index.js" + "require": "./index.js", + "bun": "./index.ts" }, "scripts": { "test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts", From e08e0bc2d1c25b8bc928e3df17301e4150481b1d Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:03:26 -0500 Subject: [PATCH 3/8] Clean up tests to prevent TypeScript build warnings --- package.json | 5 ++--- test/unit/api.test.ts | 3 +-- test/unit/helpers/msearch.test.ts | 36 +++++++++++++++---------------- test/unit/helpers/scroll.test.ts | 11 ++++------ 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/package.json b/package.json index 7675e6d5f..acf3393ba 100644 --- a/package.json +++ b/package.json @@ -6,13 +6,12 @@ "main": "./index.js", "types": "index.d.ts", "exports": { - "require": "./index.js", - "bun": "./index.ts" + "require": "./index.js" }, "scripts": { "test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts", "test:unit": "npm run build && tap test/unit/{*,**/*}.test.ts", - "test:unit-bun": "bunx tap test/unit/{*,**/*}.test.ts", + "test:unit-bun": "bun run build && bunx tap test/unit/{*,**/*}.test.ts", "test:coverage-100": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --100", "test:coverage-report": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov", "test:coverage-ui": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --coverage-report=html", diff --git a/test/unit/api.test.ts b/test/unit/api.test.ts index 80b3a1f7f..ecf54918f 100644 --- a/test/unit/api.test.ts +++ b/test/unit/api.test.ts @@ -188,7 +188,6 @@ test('Using the body key with a string value', async t => { const body = { query: { match_all: {} } } await client.search({ index: 'test', - // @ts-expect-error body: JSON.stringify(body) }) t.pass('ok!') @@ -205,7 +204,7 @@ test('With generic document', async t => { } const Connection = connection.buildMockConnection({ - onRequest (opts) { + onRequest (_opts) { return { statusCode: 200, body: { diff --git a/test/unit/helpers/msearch.test.ts b/test/unit/helpers/msearch.test.ts index f0290d3b3..e80c5977c 100644 --- a/test/unit/helpers/msearch.test.ts +++ b/test/unit/helpers/msearch.test.ts @@ -24,7 +24,7 @@ import FakeTimers from '@sinonjs/fake-timers' test('Basic', async t => { const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -78,7 +78,7 @@ test('Multiple searches (inside async iterator)', t => { t.plan(4) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -161,7 +161,7 @@ test('Multiple searches (async iterator exits)', t => { t.plan(4) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -242,7 +242,7 @@ test('Multiple searches (async iterator exits)', t => { test('Stop a msearch processor (promises)', async t => { const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: {} } } }) @@ -272,7 +272,7 @@ test('Bad header', t => { t.plan(1) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: {} } } }) @@ -297,7 +297,7 @@ test('Bad body', t => { t.plan(1) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: {} } } }) @@ -321,7 +321,7 @@ test('Bad body', t => { test('Retry on 429', async t => { let count = 0 const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { if (count++ === 0) { return { body: { @@ -384,7 +384,7 @@ test('Retry on 429', async t => { test('Single search errors', async t => { const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -419,7 +419,7 @@ test('Entire msearch fails', t => { t.plan(2) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { statusCode: 500, body: { @@ -454,7 +454,7 @@ test('Resolves the msearch helper', t => { t.plan(1) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: {} } } }) @@ -470,17 +470,17 @@ test('Resolves the msearch helper', t => { m.then( () => t.pass('called'), - e => t.fail('Should not fail') + _e => t.fail('Should not fail') ) - m.catch(e => t.fail('Should not fail')) + m.catch(_e => t.fail('Should not fail')) }) test('Stop the msearch helper with an error', t => { t.plan(3) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: {} } } }) @@ -511,7 +511,7 @@ test('Multiple searches (concurrency = 1)', t => { t.plan(4) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -587,7 +587,7 @@ test('Flush interval', t => { t.teardown(() => clock.uninstall()) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -640,7 +640,7 @@ test('Flush interval - early stop', t => { t.plan(2) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [{ @@ -684,7 +684,7 @@ test('Stop should resolve the helper', t => { t.plan(1) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [] @@ -709,7 +709,7 @@ test('Stop should resolve the helper (error)', t => { t.plan(3) const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { return { body: { responses: [] diff --git a/test/unit/helpers/scroll.test.ts b/test/unit/helpers/scroll.test.ts index b7ab9f735..53ff4ef9f 100644 --- a/test/unit/helpers/scroll.test.ts +++ b/test/unit/helpers/scroll.test.ts @@ -95,7 +95,6 @@ test('Clear a scroll search', async t => { 'x-elastic-client-meta': `es=${clientVersion},js=${nodeVersion},t=${transportVersion},hc=${nodeVersion},h=s` }) if (params.method === 'DELETE') { - // @ts-expect-error const body = JSON.parse(params.body) t.equal(body.scroll_id, 'id') } @@ -196,7 +195,7 @@ test('Scroll search (retry throws and maxRetries)', async t => { const expectedAttempts = maxRetries + 1 let count = 0 const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { count += 1 return { body: {}, statusCode: 429 } } @@ -217,8 +216,7 @@ test('Scroll search (retry throws and maxRetries)', async t => { }) try { - // @ts-expect-error - for await (const result of scrollSearch) { // eslint-disable-line + for await (const _result of scrollSearch) { // eslint-disable-line t.fail('we should not be here') } } catch (err: any) { @@ -344,7 +342,7 @@ test('Should not retry if maxRetries = 0', async t => { const expectedAttempts = 1 let count = 0 const MockConnection = connection.buildMockConnection({ - onRequest (params) { + onRequest (_params) { count += 1 return { body: {}, statusCode: 429 } } @@ -365,8 +363,7 @@ test('Should not retry if maxRetries = 0', async t => { }) try { - // @ts-expect-error - for await (const result of scrollSearch) { // eslint-disable-line + for await (const _result of scrollSearch) { // eslint-disable-line t.fail('we should not be here') } } catch (err: any) { From 660d6060610f6d740ac3c451258cb7c0b3e3033a Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:03:48 -0500 Subject: [PATCH 4/8] Use Node.js 22 to run codegen --- .github/make.sh | 186 ++++++++++++++++++++++++------------------------ 1 file changed, 93 insertions(+), 93 deletions(-) diff --git a/.github/make.sh b/.github/make.sh index 4c32a77b4..f02663e97 100755 --- a/.github/make.sh +++ b/.github/make.sh @@ -37,7 +37,7 @@ product="elastic/elasticsearch-js" output_folder=".buildkite/output" codegen_folder=".buildkite/output" OUTPUT_DIR="$repo/${output_folder}" -NODE_JS_VERSION=18 +NODE_JS_VERSION=22 WORKFLOW=${WORKFLOW-staging} mkdir -p "$OUTPUT_DIR" @@ -46,83 +46,83 @@ echo -e "\033[34;1mINFO:\033[0m VERSION ${STACK_VERSION}\033[0m" echo -e "\033[34;1mINFO:\033[0m OUTPUT_DIR ${OUTPUT_DIR}\033[0m" case $CMD in - clean) - echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m" - rm -rf "$output_folder" - echo -e "\033[32;1mdone.\033[0m" - exit 0 - ;; - assemble) - if [ -v $VERSION ]; then - echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m" - exit 1 - fi - echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m" - TASK=release - TASK_ARGS=("$VERSION" "$output_folder") - ;; - codegen) - if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then - # fall back to branch name or `main` if no VERSION is set - branch_name=$(git rev-parse --abbrev-ref HEAD) - if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then - echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" - VERSION="$branch_name" - else - echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m" - VERSION="main" - fi - fi - if [ "$VERSION" = 'main' ]; then - echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m" - else - echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m" - fi - - TASK=codegen - TASK_ARGS=("$VERSION") - ;; - docsgen) - if [ -v $VERSION ]; then - echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m" - exit 1 - fi - echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m" - TASK=codegen - TASK_ARGS=("$VERSION" "$codegen_folder") - ;; - examplesgen) - echo -e "\033[36;1mTARGET: generate examples\033[0m" - TASK=codegen - TASK_ARGS=("$VERSION" "$codegen_folder") - ;; - bump) - if [ -v $VERSION ]; then - echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m" - exit 1 - fi - echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m" - TASK=bump - TASK_ARGS=("$VERSION") - ;; - bumpmatrix) - if [ -v $VERSION ]; then - echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m" - exit 1 - fi - echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m" - TASK=bumpmatrix - TASK_ARGS=("$VERSION") - ;; - *) - echo -e "\n'$CMD' is not supported right now\n" - echo -e "\nUsage:" - echo -e "\t $0 release \$VERSION\n" - echo -e "\t $0 bump \$VERSION" - echo -e "\t $0 codegen \$VERSION" - exit 1 -esac +clean) + echo -e "\033[36;1mTARGET: clean workspace $output_folder\033[0m" + rm -rf "$output_folder" + echo -e "\033[32;1mdone.\033[0m" + exit 0 + ;; +assemble) + if [ -v $VERSION ]; then + echo -e "\033[31;1mTARGET: assemble -> missing version parameter\033[0m" + exit 1 + fi + echo -e "\033[36;1mTARGET: assemble artifact $VERSION\033[0m" + TASK=release + TASK_ARGS=("$VERSION" "$output_folder") + ;; +codegen) + if [ -v "$VERSION" ] || [[ -z "$VERSION" ]]; then + # fall back to branch name or `main` if no VERSION is set + branch_name=$(git rev-parse --abbrev-ref HEAD) + if [[ "$branch_name" =~ ^[0-9]+\.[0-9]+ ]]; then + echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using branch name: \`$branch_name\`\033[0m" + VERSION="$branch_name" + else + echo -e "\033[36;1mTARGET: codegen -> No VERSION argument found, using \`main\`\033[0m" + VERSION="main" + fi + fi + if [ "$VERSION" = 'main' ]; then + echo -e "\033[36;1mTARGET: codegen API $VERSION\033[0m" + else + echo -e "\033[36;1mTARGET: codegen API v$VERSION\033[0m" + fi + TASK=codegen + TASK_ARGS=("$VERSION") + ;; +docsgen) + if [ -v $VERSION ]; then + echo -e "\033[31;1mTARGET: docsgen -> missing version parameter\033[0m" + exit 1 + fi + echo -e "\033[36;1mTARGET: generate docs for $VERSION\033[0m" + TASK=codegen + TASK_ARGS=("$VERSION" "$codegen_folder") + ;; +examplesgen) + echo -e "\033[36;1mTARGET: generate examples\033[0m" + TASK=codegen + TASK_ARGS=("$VERSION" "$codegen_folder") + ;; +bump) + if [ -v $VERSION ]; then + echo -e "\033[31;1mTARGET: bump -> missing version parameter\033[0m" + exit 1 + fi + echo -e "\033[36;1mTARGET: bump to version $VERSION\033[0m" + TASK=bump + TASK_ARGS=("$VERSION") + ;; +bumpmatrix) + if [ -v $VERSION ]; then + echo -e "\033[31;1mTARGET: bumpmatrix -> missing version parameter\033[0m" + exit 1 + fi + echo -e "\033[36;1mTARGET: bump stack in test matrix to version $VERSION\033[0m" + TASK=bumpmatrix + TASK_ARGS=("$VERSION") + ;; +*) + echo -e "\n'$CMD' is not supported right now\n" + echo -e "\nUsage:" + echo -e "\t $0 release \$VERSION\n" + echo -e "\t $0 bump \$VERSION" + echo -e "\t $0 codegen \$VERSION" + exit 1 + ;; +esac # ------------------------------------------------------- # # Build Container @@ -179,36 +179,36 @@ fi # ------------------------------------------------------- # if [[ "$CMD" == "assemble" ]]; then - if compgen -G ".buildkite/output/*" > /dev/null; then - echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m" - else - echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m" - exit 1 - fi + if compgen -G ".buildkite/output/*" >/dev/null; then + echo -e "\033[32;1mTARGET: successfully assembled client v$VERSION\033[0m" + else + echo -e "\033[31;1mTARGET: assemble failed, empty workspace!\033[0m" + exit 1 + fi fi if [[ "$CMD" == "bump" ]]; then - if [ -n "$(git status --porcelain)" ]; then - echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m" - else - echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m" + if [ -n "$(git status --porcelain)" ]; then + echo -e "\033[32;1mTARGET: successfully bumped client v$VERSION\033[0m" + else + echo -e "\033[31;1mTARGET: failed bumped client v$VERSION\033[0m" exit 1 fi fi if [[ "$CMD" == "codegen" ]]; then - if [ -n "$(git status --porcelain)" ]; then - echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m" - else - echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m" + if [ -n "$(git status --porcelain)" ]; then + echo -e "\033[32;1mTARGET: successfully generated client v$VERSION\033[0m" + else + echo -e "\033[31;1mTARGET: failed generating client v$VERSION\033[0m" exit 1 fi fi if [[ "$CMD" == "docsgen" ]]; then - echo "TODO" + echo "TODO" fi if [[ "$CMD" == "examplesgen" ]]; then - echo "TODO" + echo "TODO" fi From 1508a8ed8d1e16818fb948e5810cb7b5a9684b00 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:15:05 -0500 Subject: [PATCH 5/8] Squash a couple TypeScript errors during tests These are expected errors, to test edge cases for non-TS users --- test/unit/api.test.ts | 1 + test/unit/helpers/scroll.test.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/test/unit/api.test.ts b/test/unit/api.test.ts index ecf54918f..8c9a72cdf 100644 --- a/test/unit/api.test.ts +++ b/test/unit/api.test.ts @@ -188,6 +188,7 @@ test('Using the body key with a string value', async t => { const body = { query: { match_all: {} } } await client.search({ index: 'test', + // @ts-expect-error body: JSON.stringify(body) }) t.pass('ok!') diff --git a/test/unit/helpers/scroll.test.ts b/test/unit/helpers/scroll.test.ts index 53ff4ef9f..88361bd7c 100644 --- a/test/unit/helpers/scroll.test.ts +++ b/test/unit/helpers/scroll.test.ts @@ -95,6 +95,7 @@ test('Clear a scroll search', async t => { 'x-elastic-client-meta': `es=${clientVersion},js=${nodeVersion},t=${transportVersion},hc=${nodeVersion},h=s` }) if (params.method === 'DELETE') { + // @ts-expect-error const body = JSON.parse(params.body) t.equal(body.scroll_id, 'id') } From a1626f9843170c2ed89ed93d0c9dcba71a39e6d1 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:15:43 -0500 Subject: [PATCH 6/8] Ignore Bun lockfile --- .gitignore | 1 + .npmignore | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index c38ae71df..0dd9106ed 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,4 @@ test/bundlers/parcel-test/.parcel-cache lib junit-output +bun.lockb diff --git a/.npmignore b/.npmignore index 2e604be0f..08c1043f8 100644 --- a/.npmignore +++ b/.npmignore @@ -72,3 +72,4 @@ CODE_OF_CONDUCT.md CONTRIBUTING.md src +bun.lockb From 9de336f620c8676c872f9feeafa30bcc6bfb7f2f Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:17:17 -0500 Subject: [PATCH 7/8] Drop unused index.ts --- index.ts | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) delete mode 100644 index.ts diff --git a/index.ts b/index.ts deleted file mode 100644 index 0dac730c4..000000000 --- a/index.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { - Diagnostic, - Transport, - WeightedConnectionPool, - ClusterConnectionPool, - BaseConnectionPool, - CloudConnectionPool, - BaseConnection, - HttpConnection, - UndiciConnection, - Serializer, - errors, - events -} from '@elastic/transport' - -import Client from './src/client' -import SniffingTransport from './src/sniffingTransport' - -export { - Client, - SniffingTransport, - Diagnostic, - Transport, - WeightedConnectionPool, - ClusterConnectionPool, - BaseConnectionPool, - CloudConnectionPool, - BaseConnection, - HttpConnection, - UndiciConnection, - Serializer, - errors, - events -} From f40a8c71e41dade543b8e0a5c5ef0637d31bdef5 Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Wed, 28 Aug 2024 11:36:01 -0500 Subject: [PATCH 8/8] Move unit test file list to tap config --- package.json | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index acf3393ba..31e6da8a4 100644 --- a/package.json +++ b/package.json @@ -9,12 +9,12 @@ "require": "./index.js" }, "scripts": { - "test": "npm run build && npm run lint && tap test/unit/{*,**/*}.test.ts", - "test:unit": "npm run build && tap test/unit/{*,**/*}.test.ts", - "test:unit-bun": "bun run build && bunx tap test/unit/{*,**/*}.test.ts", - "test:coverage-100": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --100", - "test:coverage-report": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage && nyc report --reporter=text-lcov > coverage.lcov", - "test:coverage-ui": "npm run build && tap test/unit/{*,**/*}.test.ts --coverage --coverage-report=html", + "test": "npm run build && npm run lint && tap", + "test:unit": "npm run build && tap", + "test:unit-bun": "bun run build && bunx tap", + "test:coverage-100": "npm run build && tap --coverage --100", + "test:coverage-report": "npm run build && tap --coverage && nyc report --reporter=text-lcov > coverage.lcov", + "test:coverage-ui": "npm run build && tap --coverage --coverage-report=html", "test:integration": "tsc && node test/integration/index.js", "lint": "ts-standard src", "lint:fix": "ts-standard --fix src", @@ -95,6 +95,7 @@ "jsx": false, "flow": false, "coverage": false, - "check-coverage": false + "check-coverage": false, + "files": "test/unit/{*,**/*}.test.ts" } }