diff --git a/.conf b/.conf new file mode 100644 index 000000000..9f57f6501 --- /dev/null +++ b/.conf @@ -0,0 +1,11 @@ +# This is a configuration file for both docker and Node.js, +# and it is meant to be committed and version controlled. + +# The target version of Meilisearch client +TARGET_VERSION="1.37.0" + +# The port at which the Meilisearch client will be served +PORT=7700 + +# Meilisearch client master key +MASTER_KEY="masterKey" diff --git a/.github/workflows/meilisearch-prototype-tests.yml b/.github/workflows/meilisearch-prototype-tests.yml index ea900d8ee..8ad9d72ef 100644 --- a/.github/workflows/meilisearch-prototype-tests.yml +++ b/.github/workflows/meilisearch-prototype-tests.yml @@ -36,15 +36,6 @@ jobs: integration_tests: runs-on: ubuntu-latest needs: ["meilisearch-version"] - services: - meilisearch: - image: getmeili/meilisearch-enterprise:${{ needs.meilisearch-version.outputs.version }} - env: - MEILI_MASTER_KEY: "masterKey" - MEILI_NO_ANALYTICS: "true" - MEILI_EXPERIMENTAL_ALLOWED_IP_NETWORKS: "any" - ports: - - "7700:7700" strategy: matrix: node-version: ["20", "22"] @@ -55,5 +46,8 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Set up Meilisearch + run: TARGET_VERSION=${{ needs.meilisearch-version.outputs.version }} docker compose --env-file .conf up -d + - name: Run tests run: pnpm test diff --git a/.github/workflows/pre-release-tests.yml b/.github/workflows/pre-release-tests.yml index 11f6deba2..425e63fb6 100644 --- a/.github/workflows/pre-release-tests.yml +++ b/.github/workflows/pre-release-tests.yml @@ -17,31 +17,9 @@ on: - "pre-release-beta/**" jobs: - meilisearch-version: - runs-on: ubuntu-latest - if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'bump-meilisearch-v') || startsWith(github.base_ref, 'pre-release-beta') - outputs: - version: ${{ steps.grep-step.outputs.meilisearch_version }} - steps: - - uses: actions/checkout@v6 - - name: Grep docker beta version of Meilisearch - id: grep-step - run: | - MEILISEARCH_VERSION=$(curl https://raw.githubusercontent.com/meilisearch/integration-guides/main/scripts/get-latest-meilisearch-rc.sh | sh) - echo "meilisearch_version=$MEILISEARCH_VERSION" >> $GITHUB_OUTPUT integration_tests: runs-on: ubuntu-latest if: github.event_name != 'pull_request' || startsWith(github.base_ref, 'bump-meilisearch-v') || startsWith(github.base_ref, 'pre-release-beta') - needs: ["meilisearch-version"] - services: - meilisearch: - image: getmeili/meilisearch-enterprise:${{ needs.meilisearch-version.outputs.version }} - env: - MEILI_MASTER_KEY: "masterKey" - MEILI_NO_ANALYTICS: "true" - MEILI_EXPERIMENTAL_ALLOWED_IP_NETWORKS: "any" - ports: - - "7700:7700" strategy: matrix: node-version: ["20", "22"] @@ -52,5 +30,8 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Set up Meilisearch + run: docker compose up -d + - name: Run tests run: pnpm test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0dc15cf93..9321c8b20 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -25,15 +25,6 @@ jobs: !startsWith(github.base_ref, 'prototype-beta/') && !startsWith(github.head_ref, 'pre-release-beta/') runs-on: ubuntu-latest - services: - meilisearch: - image: getmeili/meilisearch-enterprise:latest - env: - MEILI_MASTER_KEY: "masterKey" - MEILI_NO_ANALYTICS: "true" - MEILI_EXPERIMENTAL_ALLOWED_IP_NETWORKS: "any" - ports: - - "7700:7700" strategy: fail-fast: false matrix: @@ -45,8 +36,12 @@ jobs: with: node-version: ${{ matrix.node-version }} + - name: Set up Meilisearch + run: docker compose --env-file .conf up -d + - name: Run tests with coverage run: pnpm test --coverage + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v5 env: @@ -67,7 +62,5 @@ jobs: - uses: actions/checkout@v6 - uses: ./.github/actions/set-up-node - - name: Build project - run: pnpm build - name: Run types check run: pnpm types diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c882fba3b..8c687d244 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -45,25 +45,26 @@ What we expect: ### Requirements -To run this project, you will need: +To run and test this project, you will need: - [Node.js LTS](https://nodejs.org/en/about/previous-releases) - [pnpm](https://pnpm.io/installation#using-corepack) +- [Docker](https://www.docker.com/) ### Setup -You can set up your local environment natively or using `docker`, check out the [`docker-compose.yml`](/docker-compose.yml). - -Example of running all the checks with docker: +To install dependencies: ```bash -docker-compose run --rm package bash -c "pnpm install && pnpm test && pnpm lint" +pnpm install ``` -To install dependencies: +Set up environment variables and Meilisearch client docker service: ```bash -pnpm install +# Start the Meilisearch client docker service +# with the appropriate configuration file +docker compose --env-file .conf up -d ``` ### Tests and Linter @@ -109,6 +110,13 @@ Some notes on GitHub PRs: - All PRs must be reviewed and approved by at least one maintainer. - The PR title should be accurate and descriptive of the changes. The title of the PR will be indeed automatically added to the next [release changelogs](https://github.com/meilisearch/meilisearch-js/releases/). +### Developing features for a newer Meilisearch client target version + +Change `TARGET_VERSION` in [`/.conf`](/.conf) to the desired newer Meilisearch version. + +> [!IMPORTANT] +> The first PR for such changes should implement all the features that break the tests first. + ## Release Process (for the internal team only) Meilisearch tools follow the [Semantic Versioning Convention](https://semver.org/). diff --git a/docker-compose.yml b/docker-compose.yml index 2010b61a0..a1b27d38e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,9 @@ services: - package: - image: node:22 - tty: true - stdin_open: true - working_dir: /home/package - environment: - - MEILISEARCH_URL=http://meilisearch:7700 - depends_on: - - meilisearch - links: - - meilisearch - volumes: - - ./:/home/package - meilisearch: - image: getmeili/meilisearch-enterprise:v1.37.0 + image: getmeili/meilisearch-enterprise:v${TARGET_VERSION} ports: - - "7700:7700" + - "${PORT}:7700" environment: - - MEILI_MASTER_KEY=masterKey + - MEILI_MASTER_KEY=${MASTER_KEY} - MEILI_NO_ANALYTICS=true - MEILI_EXPERIMENTAL_ALLOWED_IP_NETWORKS=any diff --git a/package.json b/package.json index a1cc5fa34..8d8454c1a 100644 --- a/package.json +++ b/package.json @@ -33,13 +33,16 @@ "default": "./dist/cjs/token.cjs" } }, + "imports": { + "#src/*": "./src/*.ts" + }, "sideEffects": false, "repository": { "type": "git", "url": "https://github.com/meilisearch/meilisearch-js.git" }, "scripts": { - "playground:javascript": "vite serve playgrounds/javascript --open", + "playground:javascript": "pnpm -F=meilisearch-js-playground dev", "build:docs": "typedoc", "build": "vite build && tsc -p tsconfig.build.json && vite --mode production-umd build", "postbuild": "node scripts/build.js", diff --git a/playgrounds/javascript/package.json b/playgrounds/javascript/package.json index 1060bd8ac..07ab07c3e 100644 --- a/playgrounds/javascript/package.json +++ b/playgrounds/javascript/package.json @@ -1,14 +1,8 @@ { "name": "meilisearch-js-playground", "private": true, - "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", - "build": "vite build", - "preview": "vite preview" - }, - "devDependencies": { - "vite": "^6.0.11" + "dev": "vite --open" } } diff --git a/playgrounds/javascript/src/meilisearch.ts b/playgrounds/javascript/src/meilisearch.ts index 0f1818486..d68a840a9 100644 --- a/playgrounds/javascript/src/meilisearch.ts +++ b/playgrounds/javascript/src/meilisearch.ts @@ -1,8 +1,8 @@ import { Index, Meilisearch } from "../../../src/index.js"; const client = new Meilisearch({ - host: "http://127.0.0.1:7700", - apiKey: "masterKey", + host: `http://127.0.0.1:${__PORT__}`, + apiKey: __MASTER_KEY__, }); const indexUid = "movies"; const index = client.index<{ id: number; title: string; genres: string[] }>( diff --git a/playgrounds/javascript/src/vite-env.d.ts b/playgrounds/javascript/src/vite-env.d.ts index 11f02fe2a..74acd99f0 100644 --- a/playgrounds/javascript/src/vite-env.d.ts +++ b/playgrounds/javascript/src/vite-env.d.ts @@ -1 +1,3 @@ /// +declare const __MASTER_KEY__: string; +declare const __PORT__: string; diff --git a/playgrounds/javascript/vite.config.ts b/playgrounds/javascript/vite.config.ts new file mode 100644 index 000000000..ef57d41b7 --- /dev/null +++ b/playgrounds/javascript/vite.config.ts @@ -0,0 +1,20 @@ +import { env, loadEnvFile } from "node:process"; +import { defineConfig } from "vite"; + +loadEnvFile(new URL("../../.conf", import.meta.url)); +const { MASTER_KEY, PORT } = env; +if (MASTER_KEY === undefined || PORT === undefined) { + throw new Error("MASTER_KEY and/or PORT environment variables missing", { + cause: { MASTER_KEY, PORT }, + }); +} + +export default defineConfig({ + server: { host: "127.0.0.1" }, + define: Object.fromEntries( + Object.entries({ PORT, MASTER_KEY }).map(([key, val]) => [ + `__${key}__`, + JSON.stringify(val), + ]), + ), +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ad31dc0fc..83f38a7b6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,7 +13,7 @@ importers: version: 24.10.13 '@vitest/coverage-v8': specifier: 4.0.18 - version: 4.0.18(vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2)) + version: 4.0.18(vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) eslint-plugin-tsdoc: specifier: 0.5.0 version: 0.5.0(eslint@9.39.2(jiti@2.6.1))(typescript@5.9.3) @@ -46,16 +46,12 @@ importers: version: 5.9.3 vite: specifier: 7.3.0 - version: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + version: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) vitest: specifier: 4.0.18 - version: 4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + version: 4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) - playgrounds/javascript: - devDependencies: - vite: - specifier: ^6.0.11 - version: 6.4.1(@types/node@25.0.3)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + playgrounds/javascript: {} packages: @@ -80,312 +76,156 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} - '@esbuild/aix-ppc64@0.25.12': - resolution: {integrity: sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [aix] - '@esbuild/aix-ppc64@0.27.2': resolution: {integrity: sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==} engines: {node: '>=18'} cpu: [ppc64] os: [aix] - '@esbuild/android-arm64@0.25.12': - resolution: {integrity: sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [android] - '@esbuild/android-arm64@0.27.2': resolution: {integrity: sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==} engines: {node: '>=18'} cpu: [arm64] os: [android] - '@esbuild/android-arm@0.25.12': - resolution: {integrity: sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==} - engines: {node: '>=18'} - cpu: [arm] - os: [android] - '@esbuild/android-arm@0.27.2': resolution: {integrity: sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==} engines: {node: '>=18'} cpu: [arm] os: [android] - '@esbuild/android-x64@0.25.12': - resolution: {integrity: sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==} - engines: {node: '>=18'} - cpu: [x64] - os: [android] - '@esbuild/android-x64@0.27.2': resolution: {integrity: sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==} engines: {node: '>=18'} cpu: [x64] os: [android] - '@esbuild/darwin-arm64@0.25.12': - resolution: {integrity: sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [darwin] - '@esbuild/darwin-arm64@0.27.2': resolution: {integrity: sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] - '@esbuild/darwin-x64@0.25.12': - resolution: {integrity: sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==} - engines: {node: '>=18'} - cpu: [x64] - os: [darwin] - '@esbuild/darwin-x64@0.27.2': resolution: {integrity: sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==} engines: {node: '>=18'} cpu: [x64] os: [darwin] - '@esbuild/freebsd-arm64@0.25.12': - resolution: {integrity: sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [freebsd] - '@esbuild/freebsd-arm64@0.27.2': resolution: {integrity: sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] - '@esbuild/freebsd-x64@0.25.12': - resolution: {integrity: sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [freebsd] - '@esbuild/freebsd-x64@0.27.2': resolution: {integrity: sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] - '@esbuild/linux-arm64@0.25.12': - resolution: {integrity: sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==} - engines: {node: '>=18'} - cpu: [arm64] - os: [linux] - '@esbuild/linux-arm64@0.27.2': resolution: {integrity: sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==} engines: {node: '>=18'} cpu: [arm64] os: [linux] - '@esbuild/linux-arm@0.25.12': - resolution: {integrity: sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==} - engines: {node: '>=18'} - cpu: [arm] - os: [linux] - '@esbuild/linux-arm@0.27.2': resolution: {integrity: sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==} engines: {node: '>=18'} cpu: [arm] os: [linux] - '@esbuild/linux-ia32@0.25.12': - resolution: {integrity: sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==} - engines: {node: '>=18'} - cpu: [ia32] - os: [linux] - '@esbuild/linux-ia32@0.27.2': resolution: {integrity: sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==} engines: {node: '>=18'} cpu: [ia32] os: [linux] - '@esbuild/linux-loong64@0.25.12': - resolution: {integrity: sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==} - engines: {node: '>=18'} - cpu: [loong64] - os: [linux] - '@esbuild/linux-loong64@0.27.2': resolution: {integrity: sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==} engines: {node: '>=18'} cpu: [loong64] os: [linux] - '@esbuild/linux-mips64el@0.25.12': - resolution: {integrity: sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==} - engines: {node: '>=18'} - cpu: [mips64el] - os: [linux] - '@esbuild/linux-mips64el@0.27.2': resolution: {integrity: sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] - '@esbuild/linux-ppc64@0.25.12': - resolution: {integrity: sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==} - engines: {node: '>=18'} - cpu: [ppc64] - os: [linux] - '@esbuild/linux-ppc64@0.27.2': resolution: {integrity: sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] - '@esbuild/linux-riscv64@0.25.12': - resolution: {integrity: sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==} - engines: {node: '>=18'} - cpu: [riscv64] - os: [linux] - '@esbuild/linux-riscv64@0.27.2': resolution: {integrity: sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] - '@esbuild/linux-s390x@0.25.12': - resolution: {integrity: sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==} - engines: {node: '>=18'} - cpu: [s390x] - os: [linux] - '@esbuild/linux-s390x@0.27.2': resolution: {integrity: sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==} engines: {node: '>=18'} cpu: [s390x] os: [linux] - '@esbuild/linux-x64@0.25.12': - resolution: {integrity: sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==} - engines: {node: '>=18'} - cpu: [x64] - os: [linux] - '@esbuild/linux-x64@0.27.2': resolution: {integrity: sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==} engines: {node: '>=18'} cpu: [x64] os: [linux] - '@esbuild/netbsd-arm64@0.25.12': - resolution: {integrity: sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [netbsd] - '@esbuild/netbsd-arm64@0.27.2': resolution: {integrity: sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] - '@esbuild/netbsd-x64@0.25.12': - resolution: {integrity: sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==} - engines: {node: '>=18'} - cpu: [x64] - os: [netbsd] - '@esbuild/netbsd-x64@0.27.2': resolution: {integrity: sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] - '@esbuild/openbsd-arm64@0.25.12': - resolution: {integrity: sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openbsd] - '@esbuild/openbsd-arm64@0.27.2': resolution: {integrity: sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] - '@esbuild/openbsd-x64@0.25.12': - resolution: {integrity: sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==} - engines: {node: '>=18'} - cpu: [x64] - os: [openbsd] - '@esbuild/openbsd-x64@0.27.2': resolution: {integrity: sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] - '@esbuild/openharmony-arm64@0.25.12': - resolution: {integrity: sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [openharmony] - '@esbuild/openharmony-arm64@0.27.2': resolution: {integrity: sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] - '@esbuild/sunos-x64@0.25.12': - resolution: {integrity: sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==} - engines: {node: '>=18'} - cpu: [x64] - os: [sunos] - '@esbuild/sunos-x64@0.27.2': resolution: {integrity: sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==} engines: {node: '>=18'} cpu: [x64] os: [sunos] - '@esbuild/win32-arm64@0.25.12': - resolution: {integrity: sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==} - engines: {node: '>=18'} - cpu: [arm64] - os: [win32] - '@esbuild/win32-arm64@0.27.2': resolution: {integrity: sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==} engines: {node: '>=18'} cpu: [arm64] os: [win32] - '@esbuild/win32-ia32@0.25.12': - resolution: {integrity: sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==} - engines: {node: '>=18'} - cpu: [ia32] - os: [win32] - '@esbuild/win32-ia32@0.27.2': resolution: {integrity: sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==} engines: {node: '>=18'} cpu: [ia32] os: [win32] - '@esbuild/win32-x64@0.25.12': - resolution: {integrity: sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==} - engines: {node: '>=18'} - cpu: [x64] - os: [win32] - '@esbuild/win32-x64@0.27.2': resolution: {integrity: sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==} engines: {node: '>=18'} @@ -807,9 +647,6 @@ packages: '@types/node@24.10.13': resolution: {integrity: sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==} - '@types/node@25.0.3': - resolution: {integrity: sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==} - '@types/unist@3.0.2': resolution: {integrity: sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==} @@ -1046,11 +883,6 @@ packages: es-module-lexer@1.7.0: resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} - esbuild@0.25.12: - resolution: {integrity: sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==} - engines: {node: '>=18'} - hasBin: true - esbuild@0.27.2: resolution: {integrity: sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==} engines: {node: '>=18'} @@ -1175,6 +1007,9 @@ packages: resolution: {integrity: sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==} engines: {node: '>=18'} + get-tsconfig@4.13.6: + resolution: {integrity: sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==} + glob-parent@5.1.2: resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} engines: {node: '>= 6'} @@ -1538,6 +1373,9 @@ packages: resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} engines: {node: '>=4'} + resolve-pkg-maps@1.0.0: + resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} + resolve@1.22.11: resolution: {integrity: sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==} engines: {node: '>= 0.4'} @@ -1661,6 +1499,11 @@ packages: peerDependencies: typescript: '>=4.8.4' + tsx@4.21.0: + resolution: {integrity: sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==} + engines: {node: '>=18.0.0'} + hasBin: true + type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -1689,46 +1532,6 @@ packages: uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} - vite@6.4.1: - resolution: {integrity: sha512-+Oxm7q9hDoLMyJOYfUYBuHQo+dkAloi33apOPP56pzj+vsdJDzr+j1NISE5pyaAuKL4A3UD34qd0lx5+kfKp2g==} - engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} - hasBin: true - peerDependencies: - '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 - jiti: '>=1.21.0' - less: '*' - lightningcss: ^1.21.0 - sass: '*' - sass-embedded: '*' - stylus: '*' - sugarss: '*' - terser: ^5.16.0 - tsx: ^4.8.1 - yaml: ^2.4.2 - peerDependenciesMeta: - '@types/node': - optional: true - jiti: - optional: true - less: - optional: true - lightningcss: - optional: true - sass: - optional: true - sass-embedded: - optional: true - stylus: - optional: true - sugarss: - optional: true - terser: - optional: true - tsx: - optional: true - yaml: - optional: true - vite@7.3.0: resolution: {integrity: sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==} engines: {node: ^20.19.0 || >=22.12.0} @@ -1847,159 +1650,81 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} - '@esbuild/aix-ppc64@0.25.12': - optional: true - '@esbuild/aix-ppc64@0.27.2': optional: true - '@esbuild/android-arm64@0.25.12': - optional: true - '@esbuild/android-arm64@0.27.2': optional: true - '@esbuild/android-arm@0.25.12': - optional: true - '@esbuild/android-arm@0.27.2': optional: true - '@esbuild/android-x64@0.25.12': - optional: true - '@esbuild/android-x64@0.27.2': optional: true - '@esbuild/darwin-arm64@0.25.12': - optional: true - '@esbuild/darwin-arm64@0.27.2': optional: true - '@esbuild/darwin-x64@0.25.12': - optional: true - '@esbuild/darwin-x64@0.27.2': optional: true - '@esbuild/freebsd-arm64@0.25.12': - optional: true - '@esbuild/freebsd-arm64@0.27.2': optional: true - '@esbuild/freebsd-x64@0.25.12': - optional: true - '@esbuild/freebsd-x64@0.27.2': optional: true - '@esbuild/linux-arm64@0.25.12': - optional: true - '@esbuild/linux-arm64@0.27.2': optional: true - '@esbuild/linux-arm@0.25.12': - optional: true - '@esbuild/linux-arm@0.27.2': optional: true - '@esbuild/linux-ia32@0.25.12': - optional: true - '@esbuild/linux-ia32@0.27.2': optional: true - '@esbuild/linux-loong64@0.25.12': - optional: true - '@esbuild/linux-loong64@0.27.2': optional: true - '@esbuild/linux-mips64el@0.25.12': - optional: true - '@esbuild/linux-mips64el@0.27.2': optional: true - '@esbuild/linux-ppc64@0.25.12': - optional: true - '@esbuild/linux-ppc64@0.27.2': optional: true - '@esbuild/linux-riscv64@0.25.12': - optional: true - '@esbuild/linux-riscv64@0.27.2': optional: true - '@esbuild/linux-s390x@0.25.12': - optional: true - '@esbuild/linux-s390x@0.27.2': optional: true - '@esbuild/linux-x64@0.25.12': - optional: true - '@esbuild/linux-x64@0.27.2': optional: true - '@esbuild/netbsd-arm64@0.25.12': - optional: true - '@esbuild/netbsd-arm64@0.27.2': optional: true - '@esbuild/netbsd-x64@0.25.12': - optional: true - '@esbuild/netbsd-x64@0.27.2': optional: true - '@esbuild/openbsd-arm64@0.25.12': - optional: true - '@esbuild/openbsd-arm64@0.27.2': optional: true - '@esbuild/openbsd-x64@0.25.12': - optional: true - '@esbuild/openbsd-x64@0.27.2': optional: true - '@esbuild/openharmony-arm64@0.25.12': - optional: true - '@esbuild/openharmony-arm64@0.27.2': optional: true - '@esbuild/sunos-x64@0.25.12': - optional: true - '@esbuild/sunos-x64@0.27.2': optional: true - '@esbuild/win32-arm64@0.25.12': - optional: true - '@esbuild/win32-arm64@0.27.2': optional: true - '@esbuild/win32-ia32@0.25.12': - optional: true - '@esbuild/win32-ia32@0.27.2': optional: true - '@esbuild/win32-x64@0.25.12': - optional: true - '@esbuild/win32-x64@0.27.2': optional: true @@ -2307,11 +2032,6 @@ snapshots: dependencies: undici-types: 7.16.0 - '@types/node@25.0.3': - dependencies: - undici-types: 7.16.0 - optional: true - '@types/unist@3.0.2': {} '@typescript-eslint/project-service@8.46.4(typescript@5.9.3)': @@ -2372,7 +2092,7 @@ snapshots: '@typescript-eslint/types': 8.46.4 eslint-visitor-keys: 4.2.1 - '@vitest/coverage-v8@4.0.18(vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2))': + '@vitest/coverage-v8@4.0.18(vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))': dependencies: '@bcoe/v8-coverage': 1.0.2 '@vitest/utils': 4.0.18 @@ -2384,7 +2104,7 @@ snapshots: obug: 2.1.1 std-env: 3.10.0 tinyrainbow: 3.0.3 - vitest: 4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + vitest: 4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) '@vitest/expect@4.0.18': dependencies: @@ -2395,13 +2115,13 @@ snapshots: chai: 6.2.2 tinyrainbow: 3.0.3 - '@vitest/mocker@4.0.18(vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2))': + '@vitest/mocker@4.0.18(vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2))': dependencies: '@vitest/spy': 4.0.18 estree-walker: 3.0.3 magic-string: 0.30.21 optionalDependencies: - vite: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + vite: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) '@vitest/pretty-format@4.0.18': dependencies: @@ -2554,35 +2274,6 @@ snapshots: es-module-lexer@1.7.0: {} - esbuild@0.25.12: - optionalDependencies: - '@esbuild/aix-ppc64': 0.25.12 - '@esbuild/android-arm': 0.25.12 - '@esbuild/android-arm64': 0.25.12 - '@esbuild/android-x64': 0.25.12 - '@esbuild/darwin-arm64': 0.25.12 - '@esbuild/darwin-x64': 0.25.12 - '@esbuild/freebsd-arm64': 0.25.12 - '@esbuild/freebsd-x64': 0.25.12 - '@esbuild/linux-arm': 0.25.12 - '@esbuild/linux-arm64': 0.25.12 - '@esbuild/linux-ia32': 0.25.12 - '@esbuild/linux-loong64': 0.25.12 - '@esbuild/linux-mips64el': 0.25.12 - '@esbuild/linux-ppc64': 0.25.12 - '@esbuild/linux-riscv64': 0.25.12 - '@esbuild/linux-s390x': 0.25.12 - '@esbuild/linux-x64': 0.25.12 - '@esbuild/netbsd-arm64': 0.25.12 - '@esbuild/netbsd-x64': 0.25.12 - '@esbuild/openbsd-arm64': 0.25.12 - '@esbuild/openbsd-x64': 0.25.12 - '@esbuild/openharmony-arm64': 0.25.12 - '@esbuild/sunos-x64': 0.25.12 - '@esbuild/win32-arm64': 0.25.12 - '@esbuild/win32-ia32': 0.25.12 - '@esbuild/win32-x64': 0.25.12 - esbuild@0.27.2: optionalDependencies: '@esbuild/aix-ppc64': 0.27.2 @@ -2751,6 +2442,11 @@ snapshots: get-east-asian-width@1.4.0: {} + get-tsconfig@4.13.6: + dependencies: + resolve-pkg-maps: 1.0.0 + optional: true + glob-parent@5.1.2: dependencies: is-glob: 4.0.3 @@ -3188,6 +2884,9 @@ snapshots: resolve-from@4.0.0: {} + resolve-pkg-maps@1.0.0: + optional: true + resolve@1.22.11: dependencies: is-core-module: 2.16.1 @@ -3319,6 +3018,14 @@ snapshots: dependencies: typescript: 5.9.3 + tsx@4.21.0: + dependencies: + esbuild: 0.27.2 + get-tsconfig: 4.13.6 + optionalDependencies: + fsevents: 2.3.3 + optional: true + type-check@0.4.0: dependencies: prelude-ls: 1.2.1 @@ -3346,22 +3053,7 @@ snapshots: dependencies: punycode: 2.3.1 - vite@6.4.1(@types/node@25.0.3)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2): - dependencies: - esbuild: 0.25.12 - fdir: 6.5.0(picomatch@4.0.3) - picomatch: 4.0.3 - postcss: 8.5.6 - rollup: 4.53.3 - tinyglobby: 0.2.15 - optionalDependencies: - '@types/node': 25.0.3 - fsevents: 2.3.3 - jiti: 2.6.1 - terser: 5.44.1 - yaml: 2.8.2 - - vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2): + vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2): dependencies: esbuild: 0.27.2 fdir: 6.5.0(picomatch@4.0.3) @@ -3374,12 +3066,13 @@ snapshots: fsevents: 2.3.3 jiti: 2.6.1 terser: 5.44.1 + tsx: 4.21.0 yaml: 2.8.2 - vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2): + vitest@4.0.18(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2): dependencies: '@vitest/expect': 4.0.18 - '@vitest/mocker': 4.0.18(vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2)) + '@vitest/mocker': 4.0.18(vite@7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2)) '@vitest/pretty-format': 4.0.18 '@vitest/runner': 4.0.18 '@vitest/snapshot': 4.0.18 @@ -3396,7 +3089,7 @@ snapshots: tinyexec: 1.0.2 tinyglobby: 0.2.15 tinyrainbow: 3.0.3 - vite: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(yaml@2.8.2) + vite: 7.3.0(@types/node@24.10.13)(jiti@2.6.1)(terser@5.44.1)(tsx@4.21.0)(yaml@2.8.2) why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 24.10.13 diff --git a/src/meilisearch.ts b/src/meilisearch.ts index f5ac66faf..8e266bcc6 100644 --- a/src/meilisearch.ts +++ b/src/meilisearch.ts @@ -612,8 +612,14 @@ export class MeiliSearch { * * @returns Promise returning an object with health details */ - async health(): Promise { - return await this.httpRequest.get({ path: "health" }); + async health( + // TODO: Need to do this for all other methods: https://github.com/meilisearch/meilisearch-js/issues/1476 + extraRequestInit?: ExtraRequestInit, + ): Promise { + return await this.httpRequest.get({ + path: "health", + extraRequestInit, + }); } /** diff --git a/tests/chat-settings.test.ts b/tests/chat-settings.test.ts index b132fd19c..05ab553f3 100644 --- a/tests/chat-settings.test.ts +++ b/tests/chat-settings.test.ts @@ -10,7 +10,7 @@ import { ErrorStatusCode, type ChatSettings, type SearchParams, -} from "../src/types/index.js"; +} from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/chat-workspaces.test.ts b/tests/chat-workspaces.test.ts index b44dd202b..15727eebd 100644 --- a/tests/chat-workspaces.test.ts +++ b/tests/chat-workspaces.test.ts @@ -1,6 +1,6 @@ import { beforeAll, expect, test } from "vitest"; import { getClient, dataset } from "./utils/meilisearch-test-utils.js"; -import type { ChatWorkspaceSettings } from "../src/types/types.js"; +import type { ChatWorkspaceSettings } from "#src/index"; beforeAll(async () => { const client = await getClient("Admin"); diff --git a/tests/client.test.ts b/tests/client.test.ts index 99958a2ab..22fd2a138 100644 --- a/tests/client.test.ts +++ b/tests/client.test.ts @@ -14,9 +14,9 @@ import type { Stats, IndexSwap, InitializeNetworkOptions, -} from "../src/index.js"; -import { ErrorStatusCode, MeiliSearchRequestError } from "../src/index.js"; -import { HttpRequests } from "../src/http-requests.js"; +} from "#src/index"; +import { ErrorStatusCode, MeiliSearchRequestError } from "#src/index"; +import { HttpRequests } from "#src/http-requests"; import pkg from "../package.json" with { type: "json" }; import { clearAllIndexes, diff --git a/tests/displayed_attributes.test.ts b/tests/displayed_attributes.test.ts index b2779437d..934617c18 100644 --- a/tests/displayed_attributes.test.ts +++ b/tests/displayed_attributes.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/distinct_attribute.test.ts b/tests/distinct_attribute.test.ts index ae9907ac7..c38395e37 100644 --- a/tests/distinct_attribute.test.ts +++ b/tests/distinct_attribute.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/documents.test.ts b/tests/documents.test.ts index 0d78efa08..f2439259d 100644 --- a/tests/documents.test.ts +++ b/tests/documents.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import { ErrorStatusCode, type ResourceResults } from "../src/index.js"; +import { ErrorStatusCode, type ResourceResults } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/dump.test.ts b/tests/dump.test.ts index 75c971533..e7c9ef2ca 100644 --- a/tests/dump.test.ts +++ b/tests/dump.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, beforeEach, assert } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/embedders.test.ts b/tests/embedders.test.ts index a7a7796b7..e392ac28c 100644 --- a/tests/embedders.test.ts +++ b/tests/embedders.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import type { Embedders } from "../src/types/index.js"; +import type { Embedders } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/errors.test.ts b/tests/errors.test.ts index f9596f98a..9cc22fa22 100644 --- a/tests/errors.test.ts +++ b/tests/errors.test.ts @@ -1,13 +1,12 @@ -import { test, describe, beforeEach, vi } from "vitest"; +import { test, describe, vi, beforeAll } from "vitest"; import { MeiliSearch, assert } from "./utils/meilisearch-test-utils.js"; -import { MeiliSearchRequestError } from "../src/index.js"; +import { MeiliSearchRequestError } from "#src/index"; const mockedFetch = vi.fn(); -globalThis.fetch = mockedFetch; describe("Test on updates", () => { - beforeEach(() => { - mockedFetch.mockReset(); + beforeAll(() => { + globalThis.fetch = mockedFetch; }); test(`Throw MeilisearchRequestError when thrown error is not MeiliSearchApiError`, async () => { diff --git a/tests/experimental-features.test.ts b/tests/experimental-features.test.ts index 5823ac858..d3e9cf5f8 100644 --- a/tests/experimental-features.test.ts +++ b/tests/experimental-features.test.ts @@ -1,6 +1,6 @@ import { afterAll, test } from "vitest"; import { assert, getClient } from "./utils/meilisearch-test-utils.js"; -import type { RuntimeTogglableFeatures } from "../src/index.js"; +import type { RuntimeTogglableFeatures } from "#src/index"; const ms = await getClient("Master"); diff --git a/tests/facet_search_settings.test.ts b/tests/facet_search_settings.test.ts index d1bb67dbe..358e8c1c8 100644 --- a/tests/facet_search_settings.test.ts +++ b/tests/facet_search_settings.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/faceting.test.ts b/tests/faceting.test.ts index dc942b810..ce696bf8c 100644 --- a/tests/faceting.test.ts +++ b/tests/faceting.test.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, } from "vitest"; -import { ErrorStatusCode, type Faceting } from "../src/index.js"; +import { ErrorStatusCode, type Faceting } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/fields.test.ts b/tests/fields.test.ts index def74fbed..5d3ce8c8a 100644 --- a/tests/fields.test.ts +++ b/tests/fields.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, beforeEach, afterAll } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/filterable_attributes.test.ts b/tests/filterable_attributes.test.ts index c59c87942..460d39a55 100644 --- a/tests/filterable_attributes.test.ts +++ b/tests/filterable_attributes.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, beforeEach, afterAll } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/get_search.test.ts b/tests/get_search.test.ts index 08299cd43..46d4e8641 100644 --- a/tests/get_search.test.ts +++ b/tests/get_search.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, afterAll, beforeAll } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/http-requests.test.ts b/tests/http-requests.test.ts index 7c81a19c0..78dc522ea 100644 --- a/tests/http-requests.test.ts +++ b/tests/http-requests.test.ts @@ -3,17 +3,20 @@ import { beforeEach, describe, expect, + inject, test, vi, type MockInstance, } from "vitest"; -import { HttpRequests } from "../src/http-requests.js"; -import type { Config } from "../src/types/index.js"; +import { HttpRequests } from "#src/http-requests"; +import type { Config } from "#src/index"; import { MeiliSearchError, MeiliSearchRequestError, MeiliSearchApiError, -} from "../src/errors/index.js"; +} from "#src/index"; + +const PORT = inject("PORT"); describe("HttpRequests", () => { let fetchSpy: MockInstance; @@ -32,7 +35,7 @@ describe("HttpRequests", () => { .fn() .mockResolvedValue({ data: "not a stream" }); const config: Config = { - host: "http://localhost:7700", + host: `http://localhost:${PORT}`, httpClient: customHttpClient, }; const httpRequests = new HttpRequests(config); @@ -46,7 +49,7 @@ describe("HttpRequests", () => { const mockStream = new ReadableStream(); const customHttpClient = vi.fn().mockResolvedValue(mockStream); const config: Config = { - host: "http://localhost:7700", + host: `http://localhost:${PORT}`, httpClient: customHttpClient, }; const httpRequests = new HttpRequests(config); @@ -63,7 +66,7 @@ describe("HttpRequests", () => { }), ); - const config: Config = { host: "http://localhost:7700" }; + const config: Config = { host: `http://localhost:${PORT}` }; const httpRequests = new HttpRequests(config); await expect( @@ -79,7 +82,7 @@ describe("HttpRequests", () => { }), ); - const config: Config = { host: "http://localhost:7700" }; + const config: Config = { host: `http://localhost:${PORT}` }; const httpRequests = new HttpRequests(config); await expect( @@ -95,7 +98,7 @@ describe("HttpRequests", () => { }), ); - const config: Config = { host: "http://localhost:7700" }; + const config: Config = { host: `http://localhost:${PORT}` }; const httpRequests = new HttpRequests(config); await expect( diff --git a/tests/index.test.ts b/tests/index.test.ts index add24e670..5b10b9dff 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, beforeEach, afterAll } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/keys.test.ts b/tests/keys.test.ts index a1e305d07..c564ab7dc 100644 --- a/tests/keys.test.ts +++ b/tests/keys.test.ts @@ -1,6 +1,6 @@ import { expect, test, describe, beforeEach, afterAll } from "vitest"; -import { MeiliSearch } from "../src/index.js"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { MeiliSearch } from "#src/index"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/localized_attributes.test.ts b/tests/localized_attributes.test.ts index 963f406be..8dd02e1e7 100644 --- a/tests/localized_attributes.test.ts +++ b/tests/localized_attributes.test.ts @@ -6,10 +6,7 @@ import { expect, test, } from "vitest"; -import { - ErrorStatusCode, - type LocalizedAttributes, -} from "../src/types/index.js"; +import { ErrorStatusCode, type LocalizedAttributes } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/multi_modal_search.test.ts b/tests/multi_modal_search.test.ts index 95e02c045..9d173bc6b 100644 --- a/tests/multi_modal_search.test.ts +++ b/tests/multi_modal_search.test.ts @@ -1,8 +1,8 @@ import { beforeAll, describe, expect, test } from "vitest"; import { getClient } from "./utils/meilisearch-test-utils.js"; -import type { Embedder } from "../src/types/types.js"; +import type { Embedder } from "#src/index"; import movies from "./fixtures/movies.json" assert { type: "json" }; -import type { Meilisearch } from "../src/index.js"; +import type { Meilisearch } from "#src/index"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; import { readFileSync } from "node:fs"; diff --git a/tests/pagination.test.ts b/tests/pagination.test.ts index 18df14dca..84ab7e79f 100644 --- a/tests/pagination.test.ts +++ b/tests/pagination.test.ts @@ -6,7 +6,7 @@ import { afterAll, beforeAll, } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/prefix_search_settings.test.ts b/tests/prefix_search_settings.test.ts index 77685c5fc..1710fba13 100644 --- a/tests/prefix_search_settings.test.ts +++ b/tests/prefix_search_settings.test.ts @@ -1,5 +1,5 @@ import { afterAll, expect, test, describe, beforeEach } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/ranking_rules.test.ts b/tests/ranking_rules.test.ts index 6f36596f5..dd1808f68 100644 --- a/tests/ranking_rules.test.ts +++ b/tests/ranking_rules.test.ts @@ -1,5 +1,5 @@ import { expect, test, describe, beforeEach, afterAll } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/raw_document.test.ts b/tests/raw_document.test.ts index be1b8aaf5..1a0cf7b03 100644 --- a/tests/raw_document.test.ts +++ b/tests/raw_document.test.ts @@ -4,7 +4,7 @@ import { config, getClient, } from "./utils/meilisearch-test-utils.js"; -import { ContentTypeEnum } from "../src/types/index.js"; +import { ContentTypeEnum } from "#src/index"; beforeEach(() => clearAllIndexes(config)); diff --git a/tests/search.test.ts b/tests/search.test.ts index 05afb9a4c..d95b65793 100644 --- a/tests/search.test.ts +++ b/tests/search.test.ts @@ -7,11 +7,8 @@ import { beforeAll, vi, } from "vitest"; -import { ErrorStatusCode, MatchingStrategies } from "../src/types/index.js"; -import type { - FederatedMultiSearchParams, - MultiSearchParams, -} from "../src/types/index.js"; +import { ErrorStatusCode, MatchingStrategies } from "#src/index"; +import type { FederatedMultiSearchParams, MultiSearchParams } from "#src/index"; import { clearAllIndexes, config, @@ -23,7 +20,7 @@ import { HOST, assert, } from "./utils/meilisearch-test-utils.js"; -import { MeiliSearchRequestError } from "../src/index.js"; +import { MeiliSearchRequestError } from "#src/index"; const index = { uid: "books", diff --git a/tests/search_cutoff_ms.test.ts b/tests/search_cutoff_ms.test.ts index 7c96faa04..73a001baa 100644 --- a/tests/search_cutoff_ms.test.ts +++ b/tests/search_cutoff_ms.test.ts @@ -6,7 +6,7 @@ import { expect, test, } from "vitest"; -import { ErrorStatusCode, type SearchCutoffMs } from "../src/index.js"; +import { ErrorStatusCode, type SearchCutoffMs } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/searchable_attributes.test.ts b/tests/searchable_attributes.test.ts index 8a1b1030f..e04cd9e81 100644 --- a/tests/searchable_attributes.test.ts +++ b/tests/searchable_attributes.test.ts @@ -6,7 +6,7 @@ import { expect, test, } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/settings.test.ts b/tests/settings.test.ts index c6c71dd75..c7a91ea27 100644 --- a/tests/settings.test.ts +++ b/tests/settings.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeEach, describe, expect, test } from "vitest"; -import { ErrorStatusCode, type Settings } from "../src/types/index.js"; +import { ErrorStatusCode, type Settings } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/setup/index.ts b/tests/setup/index.ts new file mode 100644 index 000000000..9094bbb70 --- /dev/null +++ b/tests/setup/index.ts @@ -0,0 +1,68 @@ +import { env, loadEnvFile } from "node:process"; +import { Meilisearch } from "#src/index"; +import type { TestProject } from "vitest/node"; + +loadEnvFile(new URL("../../.conf", import.meta.url)); +const { MASTER_KEY, PORT } = env; +if (MASTER_KEY === undefined || PORT === undefined) { + throw new Error("MASTER_KEY and/or PORT environment variables missing", { + cause: { MASTER_KEY, PORT }, + }); +} + +const POLL_INTERVAL = 250; +const TIMEOUT = 6_000; +const TIMEOUT_ID = Symbol(); + +const host = `http://127.0.0.1:${env.PORT}`; + +const client = new Meilisearch({ host, apiKey: env.MASTER_KEY }); + +/** Poll Meilisearch until its reachable. */ +async function waitForMeiliSearch() { + let lastError; + + const ac = new AbortController(); + + const toId = setTimeout(() => void ac.abort(TIMEOUT_ID), TIMEOUT); + + for (;;) { + try { + await client.health({ signal: ac.signal }); + + clearTimeout(toId); + + break; + } catch (error) { + if (Object.is((error as Error).cause, TIMEOUT_ID)) { + throw new Error( + `connection unsuccessful to meilisearch after ${TIMEOUT}ms`, + { cause: lastError }, + ); + } + + lastError = error; + } + + await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL)); + } +} + +/** + * Checks if there is a connection to Meilisearch before any test is run. + * + * @see {@link https://vitest.dev/config/globalsetup} + */ +export default async function (project: TestProject) { + await waitForMeiliSearch(); + + project.provide("PORT", env.PORT!); + project.provide("MASTER_KEY", env.MASTER_KEY!); +} + +declare module "vitest" { + export interface ProvidedContext { + PORT: string; + MASTER_KEY: string; + } +} diff --git a/tests/snapshots.test.ts b/tests/snapshots.test.ts index 7b07ab897..7f84ef59c 100644 --- a/tests/snapshots.test.ts +++ b/tests/snapshots.test.ts @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, test, assert } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/sortable_attributes.test.ts b/tests/sortable_attributes.test.ts index 814c7f7f0..c40874dd9 100644 --- a/tests/sortable_attributes.test.ts +++ b/tests/sortable_attributes.test.ts @@ -6,7 +6,7 @@ import { expect, test, } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/stop_words.test.ts b/tests/stop_words.test.ts index e56582c2c..203d53e81 100644 --- a/tests/stop_words.test.ts +++ b/tests/stop_words.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeEach, describe, expect, test } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/synonyms.test.ts b/tests/synonyms.test.ts index 48a11835b..866009b78 100644 --- a/tests/synonyms.test.ts +++ b/tests/synonyms.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeEach, describe, expect, test } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/task.test.ts b/tests/task.test.ts index 2032e9747..77e0a9cc8 100644 --- a/tests/task.test.ts +++ b/tests/task.test.ts @@ -1,6 +1,6 @@ import { afterAll, assert, beforeEach, describe, expect, test } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; -import { sleep } from "../src/utils.js"; +import { ErrorStatusCode } from "#src/index"; +import { sleep } from "#src/utils"; import { BAD_HOST, clearAllIndexes, diff --git a/tests/tasks-and-batches.test.ts b/tests/tasks-and-batches.test.ts index b80a61c86..37b35306f 100644 --- a/tests/tasks-and-batches.test.ts +++ b/tests/tasks-and-batches.test.ts @@ -1,6 +1,6 @@ import { randomUUID } from "node:crypto"; import { beforeAll, describe, test, vi } from "vitest"; -import type { TasksOrBatchesQuery } from "../src/types/index.js"; +import type { TasksOrBatchesQuery } from "#src/index"; import { getClient, objectEntries, diff --git a/tests/token.test.ts b/tests/token.test.ts index 349c95037..1e6b94a87 100644 --- a/tests/token.test.ts +++ b/tests/token.test.ts @@ -18,13 +18,13 @@ import { assert, } from "./utils/meilisearch-test-utils.js"; import { createHmac } from "node:crypto"; -import { generateTenantToken } from "../src/token.js"; +import { generateTenantToken } from "#src/token"; import { MeiliSearch, MeiliSearchApiError, type TenantTokenHeader, type TokenClaims, -} from "../src/index.js"; +} from "#src/index"; const HASH_ALGORITHM = "HS256"; const TOKEN_TYP = "JWT"; diff --git a/tests/typed_search.test.ts b/tests/typed_search.test.ts index a34381989..4aab1ace3 100644 --- a/tests/typed_search.test.ts +++ b/tests/typed_search.test.ts @@ -6,7 +6,7 @@ import { expect, test, } from "vitest"; -import { ErrorStatusCode, type SearchResponse } from "../src/types/index.js"; +import { ErrorStatusCode, type SearchResponse } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/typo_tolerance.test.ts b/tests/typo_tolerance.test.ts index ba8bcc854..fd29b5aae 100644 --- a/tests/typo_tolerance.test.ts +++ b/tests/typo_tolerance.test.ts @@ -1,5 +1,5 @@ import { afterAll, beforeEach, describe, expect, test } from "vitest"; -import { ErrorStatusCode } from "../src/types/index.js"; +import { ErrorStatusCode } from "#src/index"; import { clearAllIndexes, config, diff --git a/tests/utils/assertions/error.ts b/tests/utils/assertions/error.ts index a17047494..f2e4bfde4 100644 --- a/tests/utils/assertions/error.ts +++ b/tests/utils/assertions/error.ts @@ -1,5 +1,5 @@ import { assert } from "vitest"; -import type { MeiliSearchErrorResponse } from "../../../src/index.js"; +import type { MeiliSearchErrorResponse } from "#src/index"; export const errorAssertions = { isErrorResponse(error: MeiliSearchErrorResponse) { diff --git a/tests/utils/assertions/tasks-and-batches.ts b/tests/utils/assertions/tasks-and-batches.ts index 724190423..007cb4122 100644 --- a/tests/utils/assertions/tasks-and-batches.ts +++ b/tests/utils/assertions/tasks-and-batches.ts @@ -6,7 +6,7 @@ import type { EnqueuedTask, BatchesResults, Task, -} from "../../../src/types/index.js"; +} from "#src/index"; import { assert } from "vitest"; import { objectKeys } from "../object.js"; import { errorAssertions } from "./error.js"; diff --git a/tests/utils/meilisearch-test-utils.ts b/tests/utils/meilisearch-test-utils.ts index fb9b8f74c..024189c92 100644 --- a/tests/utils/meilisearch-test-utils.ts +++ b/tests/utils/meilisearch-test-utils.ts @@ -1,9 +1,9 @@ -import { type Config, MeiliSearch, Index } from "../../src/index.js"; +import { inject } from "vitest"; +import { type Config, MeiliSearch, Index } from "#src/index"; // testing -const MASTER_KEY = "masterKey"; -const HOST = process.env.MEILISEARCH_URL || "http://127.0.0.1:7700"; -const HOST2 = process.env.MEILISEARCH_URL_2 || "http://127.0.0.1:7701"; +const MASTER_KEY = inject("MASTER_KEY"); +const HOST = `http://127.0.0.1:${inject("PORT")}`; const BAD_HOST = "http://127.0.0.1:9999"; const config: Config = { @@ -11,21 +11,12 @@ const config: Config = { apiKey: MASTER_KEY, defaultWaitOptions: { interval: 10 }, }; -const badHostClient = new MeiliSearch({ - host: BAD_HOST, - apiKey: MASTER_KEY, -}); const masterClient = new MeiliSearch({ host: HOST, apiKey: MASTER_KEY, defaultWaitOptions: { interval: 10 }, }); -const anonymousClient = new MeiliSearch({ - host: HOST, - defaultWaitOptions: { interval: 10 }, -}); - async function getKey(permission: string): Promise { if (permission === "No") { return ""; @@ -213,12 +204,8 @@ export { clearAllIndexes, config, masterClient, - badHostClient, - anonymousClient, BAD_HOST, HOST, - HOST2, - MASTER_KEY, MeiliSearch, Index, getClient, diff --git a/tests/webhooks.test.ts b/tests/webhooks.test.ts index 4c21cda89..af1ef8716 100644 --- a/tests/webhooks.test.ts +++ b/tests/webhooks.test.ts @@ -4,7 +4,7 @@ import { Meilisearch, type WebhookCreatePayload, type WebhookUpdatePayload, -} from "../src/index.js"; +} from "#src/index"; let adminClient: Meilisearch; diff --git a/vite.config.ts b/vite.config.ts index 71a637966..0eaef6ab4 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,4 @@ -import { defineConfig, loadEnv } from "vite"; +import { defineConfig } from "vite"; import pkg from "./package.json" with { type: "json" }; const indexInput = "src/index.ts"; @@ -54,12 +54,11 @@ export default defineConfig(({ mode }) => { : undefined, }, test: { + globalSetup: "tests/setup/index.ts", include: ["tests/**/*.test.ts"], fileParallelism: false, testTimeout: 100_000, // 100 seconds coverage: { include: ["src/**/*.ts"] }, - // Allow loading env variables from `.env.test` - env: loadEnv("test", process.cwd()), }, }; });