From 75872eff0f90d2f4a66fd14f880de472e3ef9618 Mon Sep 17 00:00:00 2001 From: Jordan Shatford Date: Wed, 24 Apr 2024 13:29:09 +1000 Subject: [PATCH] feat: move vitest to root using workspace config --- .github/workflows/coverage.yml | 2 +- package.json | 9 +- packages/client-axios/package.json | 4 - packages/client-axios/vitest.config.ts | 14 --- packages/client-core/package.json | 4 - packages/client-core/vitest.config.ts | 14 --- packages/client-fetch/package.json | 4 - packages/client-fetch/vitest.config.ts | 14 --- packages/openapi-ts/package.json | 5 - packages/openapi-ts/src/index.spec.ts | 20 ++-- .../generated => }/v2/core/ApiError.ts.snap | 0 .../v2/core/ApiRequestOptions.ts.snap | 0 .../generated => }/v2/core/ApiResult.ts.snap | 0 .../v2/core/CancelablePromise.ts.snap | 0 .../generated => }/v2/core/OpenAPI.ts.snap | 0 .../generated => }/v2/core/request.ts.snap | 0 .../{test/generated => }/v2/index.ts.snap | 0 .../generated => }/v2/schemas.gen.ts.snap | 0 .../generated => }/v2/services.gen.ts.snap | 0 .../{test/generated => }/v2/types.gen.ts.snap | 0 .../generated => }/v3/core/ApiError.ts.snap | 0 .../v3/core/ApiRequestOptions.ts.snap | 0 .../generated => }/v3/core/ApiResult.ts.snap | 0 .../v3/core/CancelablePromise.ts.snap | 0 .../generated => }/v3/core/OpenAPI.ts.snap | 0 .../generated => }/v3/core/request.ts.snap | 0 .../{test/generated => }/v3/index.ts.snap | 0 .../generated => }/v3/schemas.gen.ts.snap | 0 .../generated => }/v3/services.gen.ts.snap | 0 .../{test/generated => }/v3/types.gen.ts.snap | 0 .../v3_angular/core/ApiError.ts.snap | 0 .../v3_angular/core/ApiRequestOptions.ts.snap | 0 .../v3_angular/core/ApiResult.ts.snap | 0 .../v3_angular/core/OpenAPI.ts.snap | 0 .../v3_angular/core/request.ts.snap | 0 .../generated => }/v3_angular/index.ts.snap | 0 .../v3_angular/services.gen.ts.snap | 0 .../v3_angular/types.gen.ts.snap | 0 .../v3_axios/core/ApiError.ts.snap | 0 .../v3_axios/core/ApiRequestOptions.ts.snap | 0 .../v3_axios/core/ApiResult.ts.snap | 0 .../v3_axios/core/CancelablePromise.ts.snap | 0 .../v3_axios/core/OpenAPI.ts.snap | 0 .../v3_axios/core/request.ts.snap | 0 .../generated => }/v3_axios/index.ts.snap | 0 .../v3_client/ApiClient.ts.snap | 0 .../v3_client/core/ApiError.ts.snap | 0 .../v3_client/core/ApiRequestOptions.ts.snap | 0 .../v3_client/core/ApiResult.ts.snap | 0 .../v3_client/core/BaseHttpRequest.ts.snap | 0 .../v3_client/core/CancelablePromise.ts.snap | 0 .../v3_client/core/FetchHttpRequest.ts.snap | 0 .../v3_client/core/OpenAPI.ts.snap | 0 .../v3_client/core/request.ts.snap | 0 .../generated => }/v3_client/index.ts.snap | 0 .../v3_client/services.gen.ts.snap | 0 .../v3_client/types.gen.ts.snap | 0 .../generated => }/v3_date/index.ts.snap | 0 .../generated => }/v3_date/types.gen.ts.snap | 0 .../v3_enums_typescript/core/ApiError.ts.snap | 0 .../core/ApiRequestOptions.ts.snap | 0 .../core/ApiResult.ts.snap | 0 .../core/CancelablePromise.ts.snap | 0 .../v3_enums_typescript/core/OpenAPI.ts.snap | 0 .../v3_enums_typescript/core/request.ts.snap | 0 .../v3_enums_typescript/index.ts.snap | 0 .../v3_enums_typescript/services.gen.ts.snap | 0 .../v3_enums_typescript/types.gen.ts.snap | 0 .../core/ApiError.ts.snap | 0 .../core/ApiRequestOptions.ts.snap | 0 .../core/ApiResult.ts.snap | 0 .../core/CancelablePromise.ts.snap | 0 .../core/OpenAPI.ts.snap | 0 .../core/request.ts.snap | 0 .../v3_legacy_positional_args/index.ts.snap | 0 .../services.gen.ts.snap | 0 .../types.gen.ts.snap | 0 .../generated => }/v3_models/index.ts.snap | 0 .../v3_models/types.gen.ts.snap | 0 .../v3_node/core/ApiError.ts.snap | 0 .../v3_node/core/ApiRequestOptions.ts.snap | 0 .../v3_node/core/ApiResult.ts.snap | 0 .../v3_node/core/CancelablePromise.ts.snap | 0 .../v3_node/core/OpenAPI.ts.snap | 0 .../v3_node/core/request.ts.snap | 0 .../generated => }/v3_node/index.ts.snap | 0 .../v3_options/core/ApiError.ts.snap | 0 .../v3_options/core/ApiRequestOptions.ts.snap | 0 .../v3_options/core/ApiResult.ts.snap | 0 .../v3_options/core/CancelablePromise.ts.snap | 0 .../v3_options/core/OpenAPI.ts.snap | 0 .../v3_options/core/request.ts.snap | 0 .../generated => }/v3_options/index.ts.snap | 0 .../v3_options/services.gen.ts.snap | 0 .../v3_options/types.gen.ts.snap | 0 .../v3_pascalcase/index.ts.snap | 0 .../v3_pascalcase/types.gen.ts.snap | 0 .../v3_schemas_form/index.ts.snap | 0 .../v3_schemas_form/schemas.gen.ts.snap | 0 .../v3_schemas_json/index.ts.snap | 0 .../v3_schemas_json/schemas.gen.ts.snap | 0 .../v3_services_name/index.ts.snap | 0 .../v3_services_name/services.gen.ts.snap | 0 .../v3_xhr/core/ApiError.ts.snap | 0 .../v3_xhr/core/ApiRequestOptions.ts.snap | 0 .../v3_xhr/core/ApiResult.ts.snap | 0 .../v3_xhr/core/CancelablePromise.ts.snap | 0 .../v3_xhr/core/OpenAPI.ts.snap | 0 .../v3_xhr/core/request.ts.snap | 0 .../{test/generated => }/v3_xhr/index.ts.snap | 0 packages/openapi-ts/test/bin.spec.ts | 102 +++++++++--------- ....angular.spec.ts => client.angular.e2e.ts} | 0 ...ient.axios.spec.ts => client.axios.e2e.ts} | 19 ++-- ...ient.fetch.spec.ts => client.fetch.e2e.ts} | 23 ++-- ...client.node.spec.ts => client.node.e2e.ts} | 22 ++-- .../{client.xhr.spec.ts => client.xhr.e2e.ts} | 20 ++-- .../openapi-ts/test/e2e/scripts/angular.ts | 14 ++- .../openapi-ts/test/e2e/scripts/cleanup.ts | 6 +- .../test/e2e/scripts/compileWithTypescript.ts | 5 +- .../openapi-ts/test/e2e/scripts/copyAsset.ts | 8 +- .../test/e2e/scripts/generateClient.ts | 9 +- .../openapi-ts/test/e2e/scripts/server.ts | 21 ++-- .../{v2.angular.spec.ts => v2.angular.e2e.ts} | 0 .../e2e/{v2.axios.spec.ts => v2.axios.e2e.ts} | 18 ++-- .../e2e/{v2.fetch.spec.ts => v2.fetch.e2e.ts} | 18 ++-- .../e2e/{v2.node.spec.ts => v2.node.e2e.ts} | 19 ++-- .../e2e/{v2.xhr.spec.ts => v2.xhr.e2e.ts} | 18 ++-- .../{v3.angular.spec.ts => v3.angular.e2e.ts} | 0 .../e2e/{v3.axios.spec.ts => v3.axios.e2e.ts} | 32 +++--- .../e2e/{v3.fetch.spec.ts => v3.fetch.e2e.ts} | 36 +++---- .../e2e/{v3.node.spec.ts => v3.node.e2e.ts} | 34 +++--- .../e2e/{v3.xhr.spec.ts => v3.xhr.e2e.ts} | 32 +++--- packages/openapi-ts/test/index.spec.ts | 25 +++-- packages/openapi-ts/vitest.config.e2e.ts | 16 --- packages/openapi-ts/vitest.config.unit.ts | 18 ---- pnpm-lock.yaml | 83 ++++++++++++++ tsconfig.json | 18 ++++ vitest.config.ts | 15 +++ vitest.workspace.ts | 19 ++++ 139 files changed, 435 insertions(+), 305 deletions(-) delete mode 100644 packages/client-axios/vitest.config.ts delete mode 100644 packages/client-core/vitest.config.ts delete mode 100644 packages/client-fetch/vitest.config.ts rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/schemas.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v2/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/schemas.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_angular/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_axios/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/ApiClient.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/BaseHttpRequest.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/FetchHttpRequest.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_client/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_date/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_date/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_enums_typescript/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_legacy_positional_args/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_models/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_models/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_node/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_options/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_pascalcase/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_pascalcase/types.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_schemas_form/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_schemas_form/schemas.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_schemas_json/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_schemas_json/schemas.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_services_name/index.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_services_name/services.gen.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/ApiError.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/ApiRequestOptions.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/ApiResult.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/CancelablePromise.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/OpenAPI.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/core/request.ts.snap (100%) rename packages/openapi-ts/test/__snapshots__/{test/generated => }/v3_xhr/index.ts.snap (100%) rename packages/openapi-ts/test/e2e/{client.angular.spec.ts => client.angular.e2e.ts} (100%) rename packages/openapi-ts/test/e2e/{client.axios.spec.ts => client.axios.e2e.ts} (87%) rename packages/openapi-ts/test/e2e/{client.fetch.spec.ts => client.fetch.e2e.ts} (86%) rename packages/openapi-ts/test/e2e/{client.node.spec.ts => client.node.e2e.ts} (87%) rename packages/openapi-ts/test/e2e/{client.xhr.spec.ts => client.xhr.e2e.ts} (87%) rename packages/openapi-ts/test/e2e/{v2.angular.spec.ts => v2.angular.e2e.ts} (100%) rename packages/openapi-ts/test/e2e/{v2.axios.spec.ts => v2.axios.e2e.ts} (81%) rename packages/openapi-ts/test/e2e/{v2.fetch.spec.ts => v2.fetch.e2e.ts} (80%) rename packages/openapi-ts/test/e2e/{v2.node.spec.ts => v2.node.e2e.ts} (81%) rename packages/openapi-ts/test/e2e/{v2.xhr.spec.ts => v2.xhr.e2e.ts} (80%) rename packages/openapi-ts/test/e2e/{v3.angular.spec.ts => v3.angular.e2e.ts} (100%) rename packages/openapi-ts/test/e2e/{v3.axios.spec.ts => v3.axios.e2e.ts} (85%) rename packages/openapi-ts/test/e2e/{v3.fetch.spec.ts => v3.fetch.e2e.ts} (84%) rename packages/openapi-ts/test/e2e/{v3.node.spec.ts => v3.node.e2e.ts} (84%) rename packages/openapi-ts/test/e2e/{v3.xhr.spec.ts => v3.xhr.e2e.ts} (85%) delete mode 100644 packages/openapi-ts/vitest.config.e2e.ts delete mode 100644 packages/openapi-ts/vitest.config.unit.ts create mode 100644 tsconfig.json create mode 100644 vitest.config.ts create mode 100644 vitest.workspace.ts diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 902136bb1..3fac481f3 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -43,6 +43,6 @@ jobs: uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} - directory: ./packages/openapi-ts/coverage + directory: ./coverage flags: unittests fail_ci_if_error: true diff --git a/package.json b/package.json index 0a7384f16..9ac53f93f 100644 --- a/package.json +++ b/package.json @@ -24,16 +24,17 @@ "lint": "prettier --check . && eslint .", "openapi-ts": "pnpm --filter @hey-api/openapi-ts --", "prepare": "husky", - "test:coverage": "pnpm --recursive test:coverage", - "test:e2e": "pnpm --recursive test:e2e", - "test:update": "pnpm --recursive test:update", - "test": "pnpm --recursive test", + "test": "vitest run --project unit", + "test:coverage": "vitest run --project unit --coverage", + "test:e2e": "vitest run --project e2e --no-file-parallelism", + "test:update": "vitest watch --project unit --update", "typecheck": "pnpm --recursive typecheck" }, "engines": { "node": "^18.0.0 || >=20.0.0" }, "devDependencies": { + "@angular/cli": "17.3.5", "@changesets/cli": "2.27.1", "@rollup/plugin-commonjs": "25.0.7", "@rollup/plugin-terser": "0.4.4", diff --git a/packages/client-axios/package.json b/packages/client-axios/package.json index 02a9718bb..4a5b79f89 100644 --- a/packages/client-axios/package.json +++ b/packages/client-axios/package.json @@ -41,10 +41,6 @@ "clean": "rimraf dist coverage node_modules/.cache", "dev": "rimraf dist && pnpm build-bundle --watch", "prepublishOnly": "pnpm build", - "test:coverage": "vitest run --coverage", - "test:update": "vitest watch --update", - "test:watch": "vitest watch", - "test": "vitest run", "typecheck": "tsc --noEmit" }, "engines": { diff --git a/packages/client-axios/vitest.config.ts b/packages/client-axios/vitest.config.ts deleted file mode 100644 index 0431940e9..000000000 --- a/packages/client-axios/vitest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { fileURLToPath } from 'node:url'; - -import { defineConfig } from 'vitest/config'; - -export default defineConfig({ - test: { - coverage: { - exclude: ['dist', 'src/**/*.d.ts'], - include: ['src/**/*.ts'], - provider: 'v8', - }, - root: fileURLToPath(new URL('./', import.meta.url)), - }, -}); diff --git a/packages/client-core/package.json b/packages/client-core/package.json index d78ee72dd..f99f7676a 100644 --- a/packages/client-core/package.json +++ b/packages/client-core/package.json @@ -28,10 +28,6 @@ "clean": "rimraf dist coverage node_modules/.cache", "dev": "rimraf dist && pnpm build-bundle --watch", "prepublishOnly": "pnpm build", - "test:coverage": "vitest run --coverage", - "test:update": "vitest watch --update", - "test:watch": "vitest watch", - "test": "vitest run", "typecheck": "tsc --noEmit" }, "engines": { diff --git a/packages/client-core/vitest.config.ts b/packages/client-core/vitest.config.ts deleted file mode 100644 index 0431940e9..000000000 --- a/packages/client-core/vitest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { fileURLToPath } from 'node:url'; - -import { defineConfig } from 'vitest/config'; - -export default defineConfig({ - test: { - coverage: { - exclude: ['dist', 'src/**/*.d.ts'], - include: ['src/**/*.ts'], - provider: 'v8', - }, - root: fileURLToPath(new URL('./', import.meta.url)), - }, -}); diff --git a/packages/client-fetch/package.json b/packages/client-fetch/package.json index 4318a7ba7..65393f097 100644 --- a/packages/client-fetch/package.json +++ b/packages/client-fetch/package.json @@ -41,10 +41,6 @@ "clean": "rimraf dist coverage node_modules/.cache", "dev": "rimraf dist && pnpm build-bundle --watch", "prepublishOnly": "pnpm build", - "test:coverage": "vitest run --coverage", - "test:update": "vitest watch --update", - "test:watch": "vitest watch", - "test": "vitest run", "typecheck": "tsc --noEmit" }, "engines": { diff --git a/packages/client-fetch/vitest.config.ts b/packages/client-fetch/vitest.config.ts deleted file mode 100644 index 0431940e9..000000000 --- a/packages/client-fetch/vitest.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { fileURLToPath } from 'node:url'; - -import { defineConfig } from 'vitest/config'; - -export default defineConfig({ - test: { - coverage: { - exclude: ['dist', 'src/**/*.d.ts'], - include: ['src/**/*.ts'], - provider: 'v8', - }, - root: fileURLToPath(new URL('./', import.meta.url)), - }, -}); diff --git a/packages/openapi-ts/package.json b/packages/openapi-ts/package.json index 51df0cd03..ea8a5cb9a 100644 --- a/packages/openapi-ts/package.json +++ b/packages/openapi-ts/package.json @@ -46,12 +46,7 @@ "clean": "rimraf dist test/generated test/e2e/generated coverage node_modules/.cache", "dev": "rimraf dist && pnpm build-bundle --watch", "prepublishOnly": "pnpm build", - "test:coverage": "vitest run --config vitest.config.unit.ts --coverage", - "test:e2e": "vitest run --config vitest.config.e2e.ts", "test:sample": "node test/sample.cjs", - "test:update": "vitest watch --config vitest.config.unit.ts --update", - "test:watch": "vitest watch --config vitest.config.unit.ts", - "test": "vitest run --config vitest.config.unit.ts", "typecheck": "tsc --noEmit" }, "engines": { diff --git a/packages/openapi-ts/src/index.spec.ts b/packages/openapi-ts/src/index.spec.ts index 0aa7b2f0d..e5d64aba5 100644 --- a/packages/openapi-ts/src/index.spec.ts +++ b/packages/openapi-ts/src/index.spec.ts @@ -1,21 +1,29 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + import { describe, it } from 'vitest'; import { createClient } from './index'; +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + +const v2Spec = path.resolve(__dirname, '../test/spec/v2.json'); +const v3Spec = path.resolve(__dirname, '../test/spec/v3.json'); + describe('index', () => { it('parses v2 without issues', async () => { await createClient({ dryRun: true, - input: './test/spec/v2.json', - output: './generated/v2/', + input: v2Spec, + output: path.resolve(__dirname, '../test/generated/v2/'), }); }); it('parses v3 without issues', async () => { await createClient({ dryRun: true, - input: './test/spec/v3.json', - output: './generated/v3/', + input: v3Spec, + output: path.resolve(__dirname, '../test/generated/v3/'), }); }); @@ -24,7 +32,7 @@ describe('index', () => { dryRun: true, input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/packages/openapi-ts/test/spec/v2.json', - output: './generated/v2-downloaded/', + output: path.resolve(__dirname, '../test/generated/v2-downloaded/'), }); }); @@ -33,7 +41,7 @@ describe('index', () => { dryRun: true, input: 'https://raw.githubusercontent.com/hey-api/openapi-ts/main/packages/openapi-ts/test/spec/v3.json', - output: './generated/v3-downloaded/', + output: path.resolve(__dirname, '../test/generated/v3-downloaded/'), }); }); }); diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/schemas.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/schemas.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/schemas.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v2/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v2/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v2/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/schemas.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/schemas.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/schemas.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_angular/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_angular/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_angular/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_axios/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_axios/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_axios/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/ApiClient.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/ApiClient.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/ApiClient.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/ApiClient.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/BaseHttpRequest.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/BaseHttpRequest.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/BaseHttpRequest.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/BaseHttpRequest.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/FetchHttpRequest.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/FetchHttpRequest.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/FetchHttpRequest.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/FetchHttpRequest.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_client/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_client/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_client/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_date/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_date/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_date/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_date/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_date/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_date/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_enums_typescript/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_enums_typescript/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_enums_typescript/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_legacy_positional_args/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_legacy_positional_args/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_models/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_models/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_models/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_models/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_models/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_models/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_node/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_node/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_node/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_options/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_options/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_options/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_pascalcase/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_pascalcase/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_pascalcase/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_pascalcase/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_pascalcase/types.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_pascalcase/types.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_pascalcase/types.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_pascalcase/types.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_schemas_form/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_schemas_form/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_schemas_form/schemas.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_form/schemas.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_schemas_form/schemas.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_schemas_json/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_schemas_json/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_schemas_json/schemas.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_schemas_json/schemas.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_schemas_json/schemas.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_services_name/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_services_name/index.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_services_name/services.gen.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_services_name/services.gen.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_services_name/services.gen.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiError.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiError.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiError.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiError.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiRequestOptions.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiRequestOptions.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiRequestOptions.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiRequestOptions.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiResult.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiResult.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/ApiResult.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/ApiResult.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/CancelablePromise.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/CancelablePromise.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/CancelablePromise.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/CancelablePromise.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/OpenAPI.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/OpenAPI.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/OpenAPI.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/request.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/core/request.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/core/request.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/core/request.ts.snap diff --git a/packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap b/packages/openapi-ts/test/__snapshots__/v3_xhr/index.ts.snap similarity index 100% rename from packages/openapi-ts/test/__snapshots__/test/generated/v3_xhr/index.ts.snap rename to packages/openapi-ts/test/__snapshots__/v3_xhr/index.ts.snap diff --git a/packages/openapi-ts/test/bin.spec.ts b/packages/openapi-ts/test/bin.spec.ts index 6a4ef235a..e18e78956 100755 --- a/packages/openapi-ts/test/bin.spec.ts +++ b/packages/openapi-ts/test/bin.spec.ts @@ -1,14 +1,23 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + import { sync } from 'cross-spawn'; import { describe, expect, it } from 'vitest'; +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + +const bin = path.resolve(__dirname, '../bin/index.cjs'); +const input = path.resolve(__dirname, 'spec/v3.json'); +const output = path.resolve(__dirname, 'generated/bin'); + describe('bin', () => { it('supports required parameters', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--dry-run', 'true', ]); @@ -18,11 +27,11 @@ describe('bin', () => { it('generates angular client', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'angular', '--dry-run', @@ -34,11 +43,11 @@ describe('bin', () => { it('generates axios client', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'axios', '--dry-run', @@ -50,11 +59,11 @@ describe('bin', () => { it('generates fetch client', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'fetch', '--dry-run', @@ -66,11 +75,11 @@ describe('bin', () => { it('generates node client', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'node', '--dry-run', @@ -82,11 +91,11 @@ describe('bin', () => { it('generates xhr client', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'xhr', '--dry-run', @@ -98,11 +107,11 @@ describe('bin', () => { it('supports all parameters', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--client', 'fetch', '--useOptions', @@ -123,11 +132,11 @@ describe('bin', () => { it('supports regexp parameters', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--services', '^(Simple|Types)', '--types', @@ -141,11 +150,11 @@ describe('bin', () => { it('formats output with Prettier', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--format', 'prettier', ]); @@ -155,11 +164,11 @@ describe('bin', () => { it('lints output with ESLint', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--lint', 'eslint', ]); @@ -168,18 +177,18 @@ describe('bin', () => { }); it('throws error without parameters', () => { - const result = sync('node', ['./bin/index.cjs', '--dry-run', 'true']); + const result = sync('node', [bin, '--dry-run', 'true']); expect(result.stdout.toString()).toBe(''); expect(result.stderr.toString()).toContain('Unexpected error occurred'); }); it('throws error with wrong parameters', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--unknown', '--dry-run', 'true', @@ -191,12 +200,7 @@ describe('bin', () => { }); it('displays help', () => { - const result = sync('node', [ - './bin/index.cjs', - '--help', - '--dry-run', - 'true', - ]); + const result = sync('node', [bin, '--help', '--dry-run', 'true']); expect(result.stdout.toString()).toContain(`Usage: openapi-ts [options]`); expect(result.stdout.toString()).toContain(`-i, --input `); expect(result.stdout.toString()).toContain(`-o, --output `); @@ -207,11 +211,11 @@ describe('bin', () => { describe('cli', () => { it('handles false booleans', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--debug', '--exportCore', 'false', @@ -243,11 +247,11 @@ describe('cli', () => { it('handles true booleans', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--debug', '--exportCore', 'true', @@ -273,11 +277,11 @@ describe('cli', () => { it('handles optional booleans', () => { const result = sync('node', [ - './bin/index.cjs', + bin, '--input', - './test/spec/v3.json', + input, '--output', - './test/generated/bin', + output, '--debug', '--exportCore', '--types', diff --git a/packages/openapi-ts/test/e2e/client.angular.spec.ts b/packages/openapi-ts/test/e2e/client.angular.e2e.ts similarity index 100% rename from packages/openapi-ts/test/e2e/client.angular.spec.ts rename to packages/openapi-ts/test/e2e/client.angular.e2e.ts diff --git a/packages/openapi-ts/test/e2e/client.axios.spec.ts b/packages/openapi-ts/test/e2e/client.axios.e2e.ts similarity index 87% rename from packages/openapi-ts/test/e2e/client.axios.spec.ts rename to packages/openapi-ts/test/e2e/client.axios.e2e.ts index ec7a9a60f..ebcb66f5a 100644 --- a/packages/openapi-ts/test/e2e/client.axios.spec.ts +++ b/packages/openapi-ts/test/e2e/client.axios.e2e.ts @@ -1,9 +1,14 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/client/axios/index.js') describe('client.axios', () => { beforeAll(async () => { @@ -18,7 +23,7 @@ describe('client.axios', () => { }) it('requests token', async () => { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') const client = new ApiClient({ PASSWORD: undefined, @@ -32,7 +37,7 @@ describe('client.axios', () => { }) it('uses credentials', async () => { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient({ PASSWORD: 'password', TOKEN: undefined, @@ -44,7 +49,7 @@ describe('client.axios', () => { }) it('supports complex params', async () => { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.complex.complexTypes({ @@ -58,7 +63,7 @@ describe('client.axios', () => { }) it('supports form data', async () => { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.parameters.callWithParameters( @@ -77,7 +82,7 @@ describe('client.axios', () => { it('can abort the request', async () => { let error try { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const promise = client.simple.getCallWithoutParametersAndResponse() setTimeout(() => { @@ -93,7 +98,7 @@ describe('client.axios', () => { it('should throw known error (500)', async () => { let error try { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(500) } catch (err) { @@ -124,7 +129,7 @@ describe('client.axios', () => { it('should throw unknown error (599)', async () => { let error try { - const { ApiClient } = await import('./generated/client/axios/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(599) } catch (err) { diff --git a/packages/openapi-ts/test/e2e/client.fetch.spec.ts b/packages/openapi-ts/test/e2e/client.fetch.e2e.ts similarity index 86% rename from packages/openapi-ts/test/e2e/client.fetch.spec.ts rename to packages/openapi-ts/test/e2e/client.fetch.e2e.ts index af5e32291..3fb8cd6de 100644 --- a/packages/openapi-ts/test/e2e/client.fetch.spec.ts +++ b/packages/openapi-ts/test/e2e/client.fetch.e2e.ts @@ -1,9 +1,14 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/client/fetch/index.js') describe('client.fetch', () => { beforeAll(async () => { @@ -18,7 +23,7 @@ describe('client.fetch', () => { }) it('requests token', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') const client = new ApiClient({ PASSWORD: undefined, @@ -31,7 +36,7 @@ describe('client.fetch', () => { }) it('uses credentials', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient({ PASSWORD: 'password', TOKEN: undefined, @@ -43,7 +48,7 @@ describe('client.fetch', () => { }) it('supports complex params', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.complex.complexTypes({ @@ -57,7 +62,7 @@ describe('client.fetch', () => { }) it('support form data', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.parameters.callWithParameters( @@ -74,7 +79,7 @@ describe('client.fetch', () => { }) it('support blob response data', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const result = await client.fileResponse.fileResponse('test') expect(result).toBeDefined() @@ -83,7 +88,7 @@ describe('client.fetch', () => { it('can abort the request', async () => { let error try { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const promise = client.simple.getCallWithoutParametersAndResponse() setTimeout(() => { @@ -99,7 +104,7 @@ describe('client.fetch', () => { it('should throw known error (500)', async () => { let error try { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(500) } catch (err) { @@ -130,7 +135,7 @@ describe('client.fetch', () => { it('should throw unknown error (599)', async () => { let error try { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(599) } catch (err) { @@ -160,7 +165,7 @@ describe('client.fetch', () => { }) it('it should parse query params', async () => { - const { ApiClient } = await import('./generated/client/fetch/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const result = await client.parameters.postCallWithOptionalParam({ page: 0, diff --git a/packages/openapi-ts/test/e2e/client.node.spec.ts b/packages/openapi-ts/test/e2e/client.node.e2e.ts similarity index 87% rename from packages/openapi-ts/test/e2e/client.node.spec.ts rename to packages/openapi-ts/test/e2e/client.node.e2e.ts index 27cf2330b..f6e1effc8 100644 --- a/packages/openapi-ts/test/e2e/client.node.spec.ts +++ b/packages/openapi-ts/test/e2e/client.node.e2e.ts @@ -1,9 +1,17 @@ + + +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/client/node/index.js') + describe('client.node', () => { beforeAll(async () => { @@ -18,7 +26,7 @@ describe('client.node', () => { }) it('requests token', async () => { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') const client = new ApiClient({ PASSWORD: undefined, @@ -32,7 +40,7 @@ describe('client.node', () => { }) it('uses credentials', async () => { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient({ PASSWORD: 'password', TOKEN: undefined, @@ -44,7 +52,7 @@ describe('client.node', () => { }) it('supports complex params', async () => { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.complex.complexTypes({ @@ -58,7 +66,7 @@ describe('client.node', () => { }) it('support form data', async () => { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.parameters.callWithParameters( @@ -77,7 +85,7 @@ describe('client.node', () => { it('can abort the request', async () => { let error try { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const promise = client.simple.getCallWithoutParametersAndResponse() setTimeout(() => { @@ -93,7 +101,7 @@ describe('client.node', () => { it('should throw known error (500)', async () => { let error try { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(500) } catch (err) { @@ -124,7 +132,7 @@ describe('client.node', () => { it('should throw unknown error (599)', async () => { let error try { - const { ApiClient } = await import('./generated/client/node/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(599) } catch (err) { diff --git a/packages/openapi-ts/test/e2e/client.xhr.spec.ts b/packages/openapi-ts/test/e2e/client.xhr.e2e.ts similarity index 87% rename from packages/openapi-ts/test/e2e/client.xhr.spec.ts rename to packages/openapi-ts/test/e2e/client.xhr.e2e.ts index da7e0e5bf..71209e778 100644 --- a/packages/openapi-ts/test/e2e/client.xhr.spec.ts +++ b/packages/openapi-ts/test/e2e/client.xhr.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/client/xhr/index.js') + describe.skip('client.xhr', () => { beforeAll(async () => { @@ -18,7 +24,7 @@ describe.skip('client.xhr', () => { }) it('requests token', async () => { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') const client = new ApiClient({ PASSWORD: undefined, @@ -31,7 +37,7 @@ describe.skip('client.xhr', () => { }) it('uses credentials', async () => { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient({ PASSWORD: 'password', TOKEN: undefined, @@ -43,7 +49,7 @@ describe.skip('client.xhr', () => { }) it('supports complex params', async () => { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.complex.complexTypes({ @@ -57,7 +63,7 @@ describe.skip('client.xhr', () => { }) it('support form data', async () => { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() // @ts-ignore const result = await client.parameters.callWithParameters( @@ -76,7 +82,7 @@ describe.skip('client.xhr', () => { it('can abort the request', async () => { let error try { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() const promise = client.simple.getCallWithoutParametersAndResponse() setTimeout(() => { @@ -92,7 +98,7 @@ describe.skip('client.xhr', () => { it('should throw known error (500)', async () => { let error try { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(500) } catch (err) { @@ -123,7 +129,7 @@ describe.skip('client.xhr', () => { it('should throw unknown error (599)', async () => { let error try { - const { ApiClient } = await import('./generated/client/xhr/index.js') + const { ApiClient } = await import(__filename) const client = new ApiClient() await client.error.testErrorCode(599) } catch (err) { diff --git a/packages/openapi-ts/test/e2e/scripts/angular.ts b/packages/openapi-ts/test/e2e/scripts/angular.ts index 0f0f74d73..a8e748b69 100644 --- a/packages/openapi-ts/test/e2e/scripts/angular.ts +++ b/packages/openapi-ts/test/e2e/scripts/angular.ts @@ -1,10 +1,13 @@ import { mkdirSync, rmSync } from 'node:fs' import path from 'node:path' +import { fileURLToPath } from 'node:url'; import { sync } from 'cross-spawn' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + export const createAngularProject = (dir: string, name: string) => { - const cwd = `./test/e2e/generated/${dir}/` + const cwd = path.resolve(__dirname, `../generated/${dir}/`) mkdirSync(cwd, { recursive: true }) @@ -34,12 +37,13 @@ export const createAngularProject = (dir: string, name: string) => { '--force' ], { - cwd: path.resolve(cwd), + cwd, stdio: 'inherit' } ) rmSync(`${cwd}/${name}/src/app/`, { - recursive: true + force: true, + recursive: true, }) } @@ -48,7 +52,7 @@ export const buildAngularProject = ( name: string, output: string ) => { - const cwd = `./test/e2e/generated/${dir}/${name}/` + const cwd = path.resolve(__dirname, `../generated/${dir}/${name}/`) sync( 'ng', [ @@ -63,7 +67,7 @@ export const buildAngularProject = ( 'false' ], { - cwd: path.resolve(cwd), + cwd, stdio: 'inherit' } ) diff --git a/packages/openapi-ts/test/e2e/scripts/cleanup.ts b/packages/openapi-ts/test/e2e/scripts/cleanup.ts index 716aa290e..ee9b90236 100644 --- a/packages/openapi-ts/test/e2e/scripts/cleanup.ts +++ b/packages/openapi-ts/test/e2e/scripts/cleanup.ts @@ -1,7 +1,11 @@ import { rmSync } from 'node:fs' +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = fileURLToPath(new URL('.', import.meta.url)); export const cleanup = (dir: string) => { - rmSync(`./test/e2e/generated/${dir}/`, { + rmSync(path.resolve(__dirname, `../generated/${dir}/`), { force: true, recursive: true }) diff --git a/packages/openapi-ts/test/e2e/scripts/compileWithTypescript.ts b/packages/openapi-ts/test/e2e/scripts/compileWithTypescript.ts index 2b9f8cc6e..10a11cdac 100644 --- a/packages/openapi-ts/test/e2e/scripts/compileWithTypescript.ts +++ b/packages/openapi-ts/test/e2e/scripts/compileWithTypescript.ts @@ -1,4 +1,5 @@ import path from 'node:path' +import { fileURLToPath } from 'node:url'; import { EOL } from 'os' import { @@ -11,8 +12,10 @@ import { sys } from 'typescript' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + export const compileWithTypescript = (dir: string) => { - const cwd = `./test/e2e/generated/${dir}/` + const cwd = path.resolve(__dirname, `../generated/${dir}/`) const tsconfig = { compilerOptions: { allowSyntheticDefaultImports: true, diff --git a/packages/openapi-ts/test/e2e/scripts/copyAsset.ts b/packages/openapi-ts/test/e2e/scripts/copyAsset.ts index 8a8af5140..dc5db31f4 100644 --- a/packages/openapi-ts/test/e2e/scripts/copyAsset.ts +++ b/packages/openapi-ts/test/e2e/scripts/copyAsset.ts @@ -1,8 +1,12 @@ import { copyFileSync } from 'node:fs' +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const __dirname = fileURLToPath(new URL('.', import.meta.url)); export const copyAsset = (fileNameIn: string, fileNameOut: string) => { copyFileSync( - `./test/e2e/assets/${fileNameIn}`, - `./test/e2e/generated/${fileNameOut}` + path.resolve(__dirname, `../assets/${fileNameIn}`), + path.resolve(__dirname, `../generated/${fileNameOut}`), ) } diff --git a/packages/openapi-ts/test/e2e/scripts/generateClient.ts b/packages/openapi-ts/test/e2e/scripts/generateClient.ts index e2a65dc89..3a8379ae0 100644 --- a/packages/openapi-ts/test/e2e/scripts/generateClient.ts +++ b/packages/openapi-ts/test/e2e/scripts/generateClient.ts @@ -1,6 +1,11 @@ +import path from 'path'; +import { fileURLToPath } from 'url'; + import { createClient } from '../../../' import type { Config } from '../../../src/types/config' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + export const generateClient = async ( dir: string, version: string, @@ -10,9 +15,9 @@ export const generateClient = async ( ) => { await createClient({ client, - input: `./test/spec/${version}.json`, + input: path.resolve(__dirname, `../../spec/${version}.json`), name, - output: `./test/e2e/generated/${dir}/`, + output: path.resolve(__dirname, `../generated/${dir}/`), useOptions }) } diff --git a/packages/openapi-ts/test/e2e/scripts/server.ts b/packages/openapi-ts/test/e2e/scripts/server.ts index 261630fe8..fad0550cc 100644 --- a/packages/openapi-ts/test/e2e/scripts/server.ts +++ b/packages/openapi-ts/test/e2e/scripts/server.ts @@ -1,8 +1,11 @@ import { Server } from 'node:http' import path from 'node:path' +import { fileURLToPath } from 'node:url'; import express, { Express } from 'express' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + let _app: Express let _server: Server @@ -15,7 +18,7 @@ const start = async (dir: string) => // and all other relative paths are resolved from that file. _app.use( '/js', - express.static(`./test/e2e/generated/${dir}/`, { + express.static(path.resolve(__dirname, `../generated/${dir}/`), { extensions: ['', 'js'], index: 'index.js' }) @@ -23,7 +26,7 @@ const start = async (dir: string) => _app.use( '/js', - express.static(`./test/e2e/generated/${dir}/`, { + express.static(path.resolve(__dirname, `../generated/${dir}/`), { extensions: ['', 'js'], index: 'index.js' }) @@ -31,25 +34,25 @@ const start = async (dir: string) => // Serve static assets _app.get('/runtime.js', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/runtime.js`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/runtime.js`)) }) _app.get('/polyfills.js', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/polyfills.js`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/polyfills.js`)) }) _app.get('/vendor.js', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/vendor.js`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/vendor.js`)) }) _app.get('/main.js', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/main.js`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/main.js`)) }) _app.get('/styles.css', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/styles.css`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/styles.css`)) }) _app.get('/favicon.ico', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/favicon.ico`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/favicon.ico`)) }) _app.get('/', (req, res) => { - res.sendFile(path.resolve(`./test/e2e/generated/${dir}/index.html`)) + res.sendFile(path.resolve(__dirname, `../generated/${dir}/index.html`)) }) // Register an 'echo' server for testing error codes. This will just grab the diff --git a/packages/openapi-ts/test/e2e/v2.angular.spec.ts b/packages/openapi-ts/test/e2e/v2.angular.e2e.ts similarity index 100% rename from packages/openapi-ts/test/e2e/v2.angular.spec.ts rename to packages/openapi-ts/test/e2e/v2.angular.e2e.ts diff --git a/packages/openapi-ts/test/e2e/v2.axios.spec.ts b/packages/openapi-ts/test/e2e/v2.axios.e2e.ts similarity index 81% rename from packages/openapi-ts/test/e2e/v2.axios.spec.ts rename to packages/openapi-ts/test/e2e/v2.axios.e2e.ts index f482cde18..4b8ca6a57 100644 --- a/packages/openapi-ts/test/e2e/v2.axios.spec.ts +++ b/packages/openapi-ts/test/e2e/v2.axios.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v2/axios/index.js') + describe('v2.axios', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe('v2.axios', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v2/axios/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest const result = await SimpleService.getCallWithoutParametersAndResponse() @@ -30,7 +34,7 @@ describe('v2.axios', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v2/axios/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -56,14 +60,14 @@ describe('v2.axios useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v2/axios/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v2/axios/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -74,7 +78,7 @@ describe('v2.axios useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v2/axios/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v2.fetch.spec.ts b/packages/openapi-ts/test/e2e/v2.fetch.e2e.ts similarity index 80% rename from packages/openapi-ts/test/e2e/v2.fetch.spec.ts rename to packages/openapi-ts/test/e2e/v2.fetch.e2e.ts index 345cf114b..45a74650a 100644 --- a/packages/openapi-ts/test/e2e/v2.fetch.spec.ts +++ b/packages/openapi-ts/test/e2e/v2.fetch.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v2/fetch/index.js') + describe('v2.fetch', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe('v2.fetch', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v2/fetch/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest const result = await SimpleService.getCallWithoutParametersAndResponse() @@ -29,7 +33,7 @@ describe('v2.fetch', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v2/fetch/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -55,14 +59,14 @@ describe('v2.fetch useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v2/fetch/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v2/fetch/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -73,7 +77,7 @@ describe('v2.fetch useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v2/fetch/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v2.node.spec.ts b/packages/openapi-ts/test/e2e/v2.node.e2e.ts similarity index 81% rename from packages/openapi-ts/test/e2e/v2.node.spec.ts rename to packages/openapi-ts/test/e2e/v2.node.e2e.ts index 2a4011311..314af3f4b 100644 --- a/packages/openapi-ts/test/e2e/v2.node.spec.ts +++ b/packages/openapi-ts/test/e2e/v2.node.e2e.ts @@ -1,9 +1,14 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v2/node/index.js') describe('v2.node', () => { beforeAll(async () => { @@ -18,9 +23,7 @@ describe('v2.node', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v2/node/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest const result = await SimpleService.getCallWithoutParametersAndResponse() @@ -30,7 +33,7 @@ describe('v2.node', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v2/node/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -45,7 +48,7 @@ describe('v2.node', () => { it('can abort the request', async () => { let error try { - const { SimpleService } = await import('./generated/v2/node/index.js') + const { SimpleService } = await import(__filename) const promise = SimpleService.getCallWithoutParametersAndResponse() setTimeout(() => { promise.cancel() @@ -71,14 +74,14 @@ describe('v2.node useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v2/node/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v2/node/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -89,7 +92,7 @@ describe('v2.node useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v2/node/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v2.xhr.spec.ts b/packages/openapi-ts/test/e2e/v2.xhr.e2e.ts similarity index 80% rename from packages/openapi-ts/test/e2e/v2.xhr.spec.ts rename to packages/openapi-ts/test/e2e/v2.xhr.e2e.ts index 7ad7b1f6f..635c20fce 100644 --- a/packages/openapi-ts/test/e2e/v2.xhr.spec.ts +++ b/packages/openapi-ts/test/e2e/v2.xhr.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v2/xhr/index.js') + describe.skip('v2.xhr', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe.skip('v2.xhr', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v2/xhr/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest const result = await SimpleService.getCallWithoutParametersAndResponse() @@ -29,7 +33,7 @@ describe.skip('v2.xhr', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v2/xhr/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -55,14 +59,14 @@ describe.skip('v2.xhr useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v2/xhr/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v2/xhr/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -73,7 +77,7 @@ describe.skip('v2.xhr useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v2/xhr/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v3.angular.spec.ts b/packages/openapi-ts/test/e2e/v3.angular.e2e.ts similarity index 100% rename from packages/openapi-ts/test/e2e/v3.angular.spec.ts rename to packages/openapi-ts/test/e2e/v3.angular.e2e.ts diff --git a/packages/openapi-ts/test/e2e/v3.axios.spec.ts b/packages/openapi-ts/test/e2e/v3.axios.e2e.ts similarity index 85% rename from packages/openapi-ts/test/e2e/v3.axios.spec.ts rename to packages/openapi-ts/test/e2e/v3.axios.e2e.ts index 311db4c27..3d6720a4d 100644 --- a/packages/openapi-ts/test/e2e/v3.axios.spec.ts +++ b/packages/openapi-ts/test/e2e/v3.axios.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v3/axios/index.js') + describe('v3.axios', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe('v3.axios', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/axios/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest OpenAPI.USERNAME = undefined @@ -32,9 +36,7 @@ describe('v3.axios', () => { }) it('uses credentials', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/axios/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) OpenAPI.TOKEN = undefined OpenAPI.USERNAME = 'username' OpenAPI.PASSWORD = 'password' @@ -44,7 +46,7 @@ describe('v3.axios', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v3/axios/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -57,7 +59,7 @@ describe('v3.axios', () => { }) it('supports form data', async () => { - const { ParametersService } = await import('./generated/v3/axios/index.js') + const { ParametersService } = await import(__filename) // @ts-ignore const result = await ParametersService.callWithParameters( 'valueHeader', @@ -76,7 +78,7 @@ describe('v3.axios', () => { it('can abort the request', async () => { let error try { - const { SimpleService } = await import('./generated/v3/axios/index.js') + const { SimpleService } = await import(__filename) const promise = SimpleService.getCallWithoutParametersAndResponse() setTimeout(() => { promise.cancel() @@ -91,7 +93,7 @@ describe('v3.axios', () => { it('should throw known error (500)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/axios/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(500) } catch (err) { @@ -122,7 +124,7 @@ describe('v3.axios', () => { it('should throw unknown error (599)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/axios/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(599) } catch (err) { @@ -152,7 +154,7 @@ describe('v3.axios', () => { }) it('it should parse query params', async () => { - const { ParametersService } = await import('./generated/v3/axios/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.postCallWithOptionalParam({ // @ts-ignore page: 0, @@ -179,14 +181,14 @@ describe('v3.axios useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v3/axios/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v3/axios/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -197,7 +199,7 @@ describe('v3.axios useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v3/axios/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v3.fetch.spec.ts b/packages/openapi-ts/test/e2e/v3.fetch.e2e.ts similarity index 84% rename from packages/openapi-ts/test/e2e/v3.fetch.spec.ts rename to packages/openapi-ts/test/e2e/v3.fetch.e2e.ts index 043ef92b8..9e51d4041 100644 --- a/packages/openapi-ts/test/e2e/v3.fetch.spec.ts +++ b/packages/openapi-ts/test/e2e/v3.fetch.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v3/fetch/index.js') + describe('v3.fetch', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe('v3.fetch', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/fetch/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest OpenAPI.USERNAME = undefined @@ -32,9 +36,7 @@ describe('v3.fetch', () => { }) it('uses credentials', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/fetch/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) OpenAPI.TOKEN = undefined OpenAPI.USERNAME = 'username' OpenAPI.PASSWORD = 'password' @@ -44,7 +46,7 @@ describe('v3.fetch', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v3/fetch/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -57,7 +59,7 @@ describe('v3.fetch', () => { }) it('support form data', async () => { - const { ParametersService } = await import('./generated/v3/fetch/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.callWithParameters( 'valueHeader', // @ts-ignore @@ -73,9 +75,7 @@ describe('v3.fetch', () => { }) it('support blob response data', async () => { - const { FileResponseService } = await import( - './generated/v3/fetch/index.js' - ) + const { FileResponseService } = await import(__filename) // @ts-ignore const result = await FileResponseService.fileResponse('test') expect(result).toBeDefined() @@ -84,7 +84,7 @@ describe('v3.fetch', () => { it('can abort the request', async () => { let error try { - const { SimpleService } = await import('./generated/v3/fetch/index.js') + const { SimpleService } = await import(__filename) const promise = SimpleService.getCallWithoutParametersAndResponse() setTimeout(() => { promise.cancel() @@ -99,7 +99,7 @@ describe('v3.fetch', () => { it('should throw known error (500)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/fetch/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(500) } catch (err) { @@ -130,7 +130,7 @@ describe('v3.fetch', () => { it('should throw unknown error (599)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/fetch/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(599) } catch (err) { @@ -160,7 +160,7 @@ describe('v3.fetch', () => { }) it('it should parse query params', async () => { - const { ParametersService } = await import('./generated/v3/fetch/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.postCallWithOptionalParam({ // @ts-ignore page: 0, @@ -187,14 +187,14 @@ describe('v3.fetch useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v3/fetch/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v3/fetch/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -205,7 +205,7 @@ describe('v3.fetch useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v3/fetch/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v3.node.spec.ts b/packages/openapi-ts/test/e2e/v3.node.e2e.ts similarity index 84% rename from packages/openapi-ts/test/e2e/v3.node.spec.ts rename to packages/openapi-ts/test/e2e/v3.node.e2e.ts index d11276153..3f29bad9e 100644 --- a/packages/openapi-ts/test/e2e/v3.node.spec.ts +++ b/packages/openapi-ts/test/e2e/v3.node.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v3/node/index.js') + describe('v3.node', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe('v3.node', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/node/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest OpenAPI.USERNAME = undefined @@ -32,9 +36,7 @@ describe('v3.node', () => { }) it('uses credentials', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/node/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) OpenAPI.TOKEN = undefined OpenAPI.USERNAME = 'username' OpenAPI.PASSWORD = 'password' @@ -44,7 +46,7 @@ describe('v3.node', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v3/node/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -57,7 +59,7 @@ describe('v3.node', () => { }) it('support form data', async () => { - const { ParametersService } = await import('./generated/v3/node/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.callWithParameters( 'valueHeader', // @ts-ignore @@ -73,7 +75,7 @@ describe('v3.node', () => { }) it('support blob response data', async () => { - const { FileResponseService } = await import('./generated/v3/node/index.js') + const { FileResponseService } = await import(__filename) // @ts-ignore const result = await FileResponseService.fileResponse('test') expect(result).toBeDefined() @@ -82,7 +84,7 @@ describe('v3.node', () => { it('can abort the request', async () => { let error try { - const { SimpleService } = await import('./generated/v3/node/index.js') + const { SimpleService } = await import(__filename) const promise = SimpleService.getCallWithoutParametersAndResponse() setTimeout(() => { promise.cancel() @@ -97,7 +99,7 @@ describe('v3.node', () => { it('should throw known error (500)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/node/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(500) } catch (err) { @@ -128,7 +130,7 @@ describe('v3.node', () => { it('should throw unknown error (599)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/node/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(599) } catch (err) { @@ -158,7 +160,7 @@ describe('v3.node', () => { }) it('it should parse query params', async () => { - const { ParametersService } = await import('./generated/v3/node/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.postCallWithOptionalParam({ // @ts-ignore page: 0, @@ -185,14 +187,14 @@ describe('v3.node useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v3/node/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v3/node/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -203,7 +205,7 @@ describe('v3.node useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v3/node/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/e2e/v3.xhr.spec.ts b/packages/openapi-ts/test/e2e/v3.xhr.e2e.ts similarity index 85% rename from packages/openapi-ts/test/e2e/v3.xhr.spec.ts rename to packages/openapi-ts/test/e2e/v3.xhr.e2e.ts index a4abff57d..d9fa1dc6f 100644 --- a/packages/openapi-ts/test/e2e/v3.xhr.spec.ts +++ b/packages/openapi-ts/test/e2e/v3.xhr.e2e.ts @@ -1,9 +1,15 @@ +import path from 'node:path' +import { fileURLToPath } from 'node:url' + import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest' import { cleanup } from './scripts/cleanup' import { compileWithTypescript } from './scripts/compileWithTypescript' import { generateClient } from './scripts/generateClient' import server from './scripts/server' +const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __filename = path.resolve(__dirname, 'generated/v3/xhr/index.js') + describe.skip('v3.xhr', () => { beforeAll(async () => { @@ -18,9 +24,7 @@ describe.skip('v3.xhr', () => { }) it('requests token', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/xhr/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) const tokenRequest = vi.fn().mockResolvedValue('MY_TOKEN') OpenAPI.TOKEN = tokenRequest OpenAPI.USERNAME = undefined @@ -32,9 +36,7 @@ describe.skip('v3.xhr', () => { }) it('uses credentials', async () => { - const { OpenAPI, SimpleService } = await import( - './generated/v3/xhr/index.js' - ) + const { OpenAPI, SimpleService } = await import(__filename) OpenAPI.TOKEN = undefined OpenAPI.USERNAME = 'username' OpenAPI.PASSWORD = 'password' @@ -44,7 +46,7 @@ describe.skip('v3.xhr', () => { }) it('supports complex params', async () => { - const { ComplexService } = await import('./generated/v3/xhr/index.js') + const { ComplexService } = await import(__filename) const result = await ComplexService.complexTypes({ // @ts-ignore first: { @@ -57,7 +59,7 @@ describe.skip('v3.xhr', () => { }) it('support form data', async () => { - const { ParametersService } = await import('./generated/v3/xhr/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.callWithParameters( 'valueHeader', // @ts-ignore @@ -75,7 +77,7 @@ describe.skip('v3.xhr', () => { it('can abort the request', async () => { let error try { - const { SimpleService } = await import('./generated/v3/xhr/index.js') + const { SimpleService } = await import(__filename) const promise = SimpleService.getCallWithoutParametersAndResponse() setTimeout(() => { promise.cancel() @@ -90,7 +92,7 @@ describe.skip('v3.xhr', () => { it('should throw known error (500)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/xhr/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(500) } catch (err) { @@ -121,7 +123,7 @@ describe.skip('v3.xhr', () => { it('should throw unknown error (599)', async () => { let error try { - const { ErrorService } = await import('./generated/v3/xhr/index.js') + const { ErrorService } = await import(__filename) // @ts-ignore await ErrorService.testErrorCode(599) } catch (err) { @@ -151,7 +153,7 @@ describe.skip('v3.xhr', () => { }) it('it should parse query params', async () => { - const { ParametersService } = await import('./generated/v3/xhr/index.js') + const { ParametersService } = await import(__filename) const result = await ParametersService.postCallWithOptionalParam({ // @ts-ignore page: 0, @@ -178,14 +180,14 @@ describe.skip('v3.xhr useOptions', () => { }) it('returns result body by default', async () => { - const { SimpleService } = await import('./generated/v3/xhr/index.js') + const { SimpleService } = await import(__filename) const result = await SimpleService.getCallWithoutParametersAndResponse() // @ts-ignore expect(result.body).toBeUndefined() }) it('returns result body', async () => { - const { SimpleService } = await import('./generated/v3/xhr/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'body' @@ -196,7 +198,7 @@ describe.skip('v3.xhr useOptions', () => { it('returns raw result', async ({ skip }) => { skip() - const { SimpleService } = await import('./generated/v3/xhr/index.js') + const { SimpleService } = await import(__filename) // @ts-ignore const result = await SimpleService.getCallWithoutParametersAndResponse({ _result: 'raw' diff --git a/packages/openapi-ts/test/index.spec.ts b/packages/openapi-ts/test/index.spec.ts index a06599233..51993a42e 100644 --- a/packages/openapi-ts/test/index.spec.ts +++ b/packages/openapi-ts/test/index.spec.ts @@ -1,4 +1,6 @@ import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; import { sync } from 'glob'; import { describe, expect, it } from 'vitest'; @@ -6,14 +8,19 @@ import { describe, expect, it } from 'vitest'; import { createClient } from '../'; import type { UserConfig } from '../src/types/config'; -const V2_SPEC_PATH = './test/spec/v2.json'; -const V3_SPEC_PATH = './test/spec/v3.json'; +const __dirname = fileURLToPath(new URL('.', import.meta.url)); -const OUTPUT_PREFIX = './test/generated/'; +const V2_SPEC_PATH = path.resolve(__dirname, 'spec/v2.json'); +const V3_SPEC_PATH = path.resolve(__dirname, 'spec/v3.json'); -const toOutputPath = (name: string) => `${OUTPUT_PREFIX}${name}/`; +const OUTPUT_PREFIX = path.resolve(__dirname, 'generated/'); + +const toOutputPath = (name: string) => path.resolve(OUTPUT_PREFIX, name); const toSnapshotPath = (file: string) => - `./__snapshots__/${file.replace(OUTPUT_PREFIX, '')}.snap`; + path.resolve( + __dirname, + `__snapshots__/${file.replace(OUTPUT_PREFIX, '')}.snap`, + ); describe('OpenAPI v2', () => { it.each([ @@ -39,8 +46,8 @@ describe('OpenAPI v2', () => { input: V2_SPEC_PATH, output, }); - sync(`${output}**/*.ts`).forEach((file) => { - const content = readFileSync(file, 'utf8').toString(); + sync(path.resolve(output, '**/*.ts')).forEach((file) => { + const content = readFileSync(file, { encoding: 'utf-8' }); expect(content).toMatchFileSnapshot(toSnapshotPath(file)); }); }); @@ -251,8 +258,8 @@ describe('OpenAPI v3', () => { input: V3_SPEC_PATH, output, }); - sync(`${output}**/*.ts`).forEach((file) => { - const content = readFileSync(file, 'utf8').toString(); + sync(path.resolve(output, '**/*.ts')).forEach((file) => { + const content = readFileSync(file, { encoding: 'utf-8' }).toString(); expect(content).toMatchFileSnapshot(toSnapshotPath(file)); }); }); diff --git a/packages/openapi-ts/vitest.config.e2e.ts b/packages/openapi-ts/vitest.config.e2e.ts deleted file mode 100644 index ae277b99b..000000000 --- a/packages/openapi-ts/vitest.config.e2e.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { fileURLToPath } from 'node:url'; - -import { defineConfig } from 'vitest/config'; - -import { handlebarsPlugin } from './rollup.config'; - -export default defineConfig({ - plugins: [handlebarsPlugin()], - test: { - // Dont run tests in parallel. This is to ensure the test server can start up. - // And that the port was not previously taken. - fileParallelism: false, - include: ['test/e2e/**/*.spec.ts'], - root: fileURLToPath(new URL('./', import.meta.url)), - }, -}); diff --git a/packages/openapi-ts/vitest.config.unit.ts b/packages/openapi-ts/vitest.config.unit.ts deleted file mode 100644 index 2b1683955..000000000 --- a/packages/openapi-ts/vitest.config.unit.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { fileURLToPath } from 'node:url'; - -import { configDefaults, defineConfig } from 'vitest/config'; - -import { handlebarsPlugin } from './rollup.config'; - -export default defineConfig({ - plugins: [handlebarsPlugin()], - test: { - coverage: { - exclude: ['bin', 'dist', 'src/**/*.d.ts'], - include: ['src/**/*.ts'], - provider: 'v8', - }, - exclude: [...configDefaults.exclude, 'test/e2e/**/*.spec.ts'], - root: fileURLToPath(new URL('./', import.meta.url)), - }, -}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6194b2663..9184dd38e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,9 @@ importers: .: devDependencies: + '@angular/cli': + specifier: 17.3.5 + version: 17.3.5 '@changesets/cli': specifier: 2.27.1 version: 2.27.1 @@ -461,6 +464,16 @@ packages: '@jridgewell/trace-mapping': 0.3.25 dev: true + /@angular-devkit/architect@0.1703.5: + resolution: {integrity: sha512-j3+9QeXIafuRMtk7N5Cmm/IiMSS/TOaybzfCv/LK+DP3hjEd8f8Az7hPmevUuOArvWNzUvoUeu30GmR3wABydA==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + dependencies: + '@angular-devkit/core': 17.3.5 + rxjs: 7.8.1 + transitivePeerDependencies: + - chokidar + dev: true + /@angular-devkit/architect@0.1703.6: resolution: {integrity: sha512-Ck501FD/QuOjeKVFs7hU92w8+Ffetv0d5Sq09XY2/uygo5c/thMzp9nkevaIWBxUSeU5RqYZizDrhFVgYzbbOw==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -614,6 +627,23 @@ packages: - chokidar dev: true + /@angular-devkit/core@17.3.5: + resolution: {integrity: sha512-iqGv45HVI+yRROoTqQTY0QChYlRCZkFUfIjdfJLegjc6xq9sLtxDr03CWM45BKGG5lSxDOy+qu/pdRvtL3V2eg==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + peerDependencies: + chokidar: ^3.5.2 + peerDependenciesMeta: + chokidar: + optional: true + dependencies: + ajv: 8.12.0 + ajv-formats: 2.1.1(ajv@8.12.0) + jsonc-parser: 3.2.1 + picomatch: 4.0.1 + rxjs: 7.8.1 + source-map: 0.7.4 + dev: true + /@angular-devkit/core@17.3.6: resolution: {integrity: sha512-FVbkT9dEwHEvjnxr4mvMNSMg2bCFoGoP4X68xXU9dhLEUpC05opLvfbaR3Qh543eCJ5AstosBFVzB/krfIkOvA==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -631,6 +661,19 @@ packages: source-map: 0.7.4 dev: true + /@angular-devkit/schematics@17.3.5: + resolution: {integrity: sha512-oh/mvpMKxGfk5v9QIB7LfGsDC/iVpmsIAvbb4+1ddCx86EJXdz3xWnVDbUehOd6n7HJXnQrNirWjWvWquM2GhQ==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + dependencies: + '@angular-devkit/core': 17.3.5 + jsonc-parser: 3.2.1 + magic-string: 0.30.8 + ora: 5.4.1 + rxjs: 7.8.1 + transitivePeerDependencies: + - chokidar + dev: true + /@angular-devkit/schematics@17.3.6: resolution: {integrity: sha512-2G1YuPInd8znG7uUgKOS7z72Aku50lTzB/2csWkWPJLAFkh7vKC8QZ40x8S1nC9npVYPhI5CRLX/HVpBh9CyxA==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -654,6 +697,35 @@ packages: tslib: 2.6.2 dev: true + /@angular/cli@17.3.5: + resolution: {integrity: sha512-6MHJzPKy4uB9qlJO1eKs4rtDlRuCe0lOiz1f3kHFZ/GQQm5xA1xsmZJMN4ASsnu4yU3oZs6vJ/vt8i2/jvdPbA==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + hasBin: true + dependencies: + '@angular-devkit/architect': 0.1703.5 + '@angular-devkit/core': 17.3.5 + '@angular-devkit/schematics': 17.3.5 + '@schematics/angular': 17.3.5 + '@yarnpkg/lockfile': 1.1.0 + ansi-colors: 4.1.3 + ini: 4.1.2 + inquirer: 9.2.15 + jsonc-parser: 3.2.1 + npm-package-arg: 11.0.1 + npm-pick-manifest: 9.0.0 + open: 8.4.2 + ora: 5.4.1 + pacote: 17.0.6 + resolve: 1.22.8 + semver: 7.6.0 + symbol-observable: 4.0.0 + yargs: 17.7.2 + transitivePeerDependencies: + - bluebird + - chokidar + - supports-color + dev: true + /@angular/cli@17.3.6: resolution: {integrity: sha512-poKaRPeI+hFqX+AxIaEriaIggFVcC3XqlT9E1/uBC2rfHirE1n5F9Z7xqEDtMHduKwLbNXhQIPoKIKya8+Hnew==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} @@ -3511,6 +3583,17 @@ packages: dev: true optional: true + /@schematics/angular@17.3.5: + resolution: {integrity: sha512-SWCK16Eob0K86hpZ3NHmrTS6LSzTlhvnIdf3BXC6nzoiyDhcAS0oJ2Tjdq1opW/PaL1hB7MulcbIhxYln5du0w==} + engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} + dependencies: + '@angular-devkit/core': 17.3.5 + '@angular-devkit/schematics': 17.3.5 + jsonc-parser: 3.2.1 + transitivePeerDependencies: + - chokidar + dev: true + /@schematics/angular@17.3.6: resolution: {integrity: sha512-jCNZdjHSVrI8TrrCnCoXC8GYvQRj7zh+SDdmm91Ve8dbikYNmBOKYLuPaCTsmojWx7ytv962yLlgKzpaa2bbfw==} engines: {node: ^18.13.0 || >=20.9.0, npm: ^6.11.0 || ^7.5.6 || >=8.0.0, yarn: '>= 1.13.0'} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..097bb014d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,18 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "files": [], + "references": [ + { + "path": "packages/client-axios" + }, + { + "path": "packages/client-core" + }, + { + "path": "packages/client-fetch" + }, + { + "path": "packages/openapi-ts" + } + ] +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 000000000..48e722bff --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,15 @@ +import { configDefaults, defineConfig } from 'vitest/config'; + +import { handlebarsPlugin } from './packages/openapi-ts/rollup.config'; + +export default defineConfig({ + plugins: [handlebarsPlugin()], + test: { + coverage: { + exclude: ['**/bin', '**/dist', '**/*.d.ts', '**/generated/**'], + include: ['**/src/**/*.ts'], + provider: 'v8', + }, + exclude: [...configDefaults.exclude], + }, +}); diff --git a/vitest.workspace.ts b/vitest.workspace.ts new file mode 100644 index 000000000..1ca2d824c --- /dev/null +++ b/vitest.workspace.ts @@ -0,0 +1,19 @@ +import { defineWorkspace } from 'vitest/config'; + +export default defineWorkspace([ + 'packages/*', + { + extends: './vitest.config.ts', + test: { + include: ['**/*.{spec,test}.ts'], + name: 'unit', + }, + }, + { + extends: './vitest.config.ts', + test: { + include: ['**/*.e2e.ts'], + name: 'e2e', + }, + }, +]);