Skip to content

Commit

Permalink
feat: move vitest to root using workspace config
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanshatford committed May 6, 2024
1 parent 751d7a1 commit 2b13e08
Show file tree
Hide file tree
Showing 139 changed files with 355 additions and 305 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 0 additions & 4 deletions packages/client-axios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
14 changes: 0 additions & 14 deletions packages/client-axios/vitest.config.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/client-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
14 changes: 0 additions & 14 deletions packages/client-core/vitest.config.ts

This file was deleted.

4 changes: 0 additions & 4 deletions packages/client-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
14 changes: 0 additions & 14 deletions packages/client-fetch/vitest.config.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/openapi-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
20 changes: 14 additions & 6 deletions packages/openapi-ts/src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -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/'),
});
});

Expand All @@ -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/'),
});
});

Expand All @@ -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/'),
});
});
});
Loading

0 comments on commit 2b13e08

Please sign in to comment.