Skip to content

Commit

Permalink
Add per-package vitest config and test script
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanmaric committed Jun 9, 2024
1 parent f588620 commit 7830807
Show file tree
Hide file tree
Showing 42 changed files with 208 additions and 338 deletions.
5 changes: 3 additions & 2 deletions exchanges/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -57,7 +57,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/auth/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -56,7 +56,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/context/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/execute/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -58,7 +58,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/execute/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/graphcache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"default-storage/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -79,7 +79,8 @@
"graphql": "^16.6.0",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"urql": "workspace:*"
"urql": "workspace:*",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/graphcache/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/persisted/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -55,7 +55,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/persisted/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/populate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"extras/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist extras",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -56,7 +56,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"publishConfig": {
"access": "public",
Expand Down
4 changes: 4 additions & 0 deletions exchanges/populate/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
7 changes: 4 additions & 3 deletions exchanges/refocus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -49,9 +49,10 @@
"prepublishOnly": "run-s clean build"
},
"devDependencies": {
"@urql/core": "workspace:*",
"@types/react": "^17.0.4",
"graphql": "^16.0.0"
"@urql/core": "workspace:*",
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
Expand Down
4 changes: 4 additions & 0 deletions exchanges/refocus/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/request-policy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -49,7 +49,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
Expand Down
4 changes: 4 additions & 0 deletions exchanges/request-policy/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions exchanges/retry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -49,7 +49,8 @@
},
"devDependencies": {
"@urql/core": "workspace:*",
"graphql": "^16.0.0"
"graphql": "^16.0.0",
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0"
Expand Down
4 changes: 4 additions & 0 deletions exchanges/retry/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"scripts": {
"test": "vitest",
"test": "test -z $CI && vitest || pnpm -r --parallel run test run",
"check": "tsc",
"lint": "eslint --ext=js,jsx,ts,tsx .",
"build": "node ./scripts/actions/build-all.mjs",
Expand Down
5 changes: 4 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"internal/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -61,5 +61,8 @@
"publishConfig": {
"access": "public",
"provenance": true
},
"devDependencies": {
"vitest": "^0.30.1"
}
}
4 changes: 4 additions & 0 deletions packages/core/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
2 changes: 0 additions & 2 deletions packages/introspection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -51,7 +50,6 @@
"peerDependencies": {
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
},
"dependencies": {},
"publishConfig": {
"access": "public",
"provenance": true
Expand Down
4 changes: 4 additions & 0 deletions packages/next-urql/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
7 changes: 4 additions & 3 deletions packages/preact-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -49,10 +49,11 @@
"prepublishOnly": "run-s clean build"
},
"devDependencies": {
"@urql/core": "workspace:*",
"@testing-library/preact": "^2.0.0",
"@urql/core": "workspace:*",
"graphql": "^16.0.0",
"preact": "^10.13.0"
"preact": "^10.13.0",
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/preact-urql/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
5 changes: 3 additions & 2 deletions packages/react-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dist/"
],
"scripts": {
"test": "vitest --config ../../vitest.config.ts",
"test": "vitest",
"clean": "rimraf dist",
"check": "tsc --noEmit",
"lint": "eslint --ext=js,jsx,ts,tsx .",
Expand All @@ -55,7 +55,8 @@
"react-is": "^17.0.1",
"react-ssr-prepass": "^1.1.2",
"react-test-renderer": "^17.0.1",
"vite": "^3.2.4"
"vite": "^3.2.4",
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/react-urql/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { mergeConfig } from 'vitest/config';
import baseConfig from '../../vitest.config';

export default mergeConfig(baseConfig, {});
12 changes: 12 additions & 0 deletions packages/solid-urql/bak.vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { resolve } from 'path';
import { defineProject } from 'vitest/config';
import solidPlugin from 'vite-plugin-solid';
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineProject({
extends: '../../vitest.config.ts',

Check failure on line 7 in packages/solid-urql/bak.vitest.config.ts

View workflow job for this annotation

GitHub Actions / Checks

Argument of type '{ extends: string; plugins: Plugin_2[]; }' is not assignable to parameter of type 'UserProjectConfigExport'.
plugins: [
tsconfigPaths({ root: resolve(__dirname, '../../') }),
solidPlugin({ hot: false }),
],
});
3 changes: 1 addition & 2 deletions packages/solid-urql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@
},
"devDependencies": {
"@solidjs/testing-library": "^0.8.2",
"@testing-library/jest-dom": "^5.16.5",
"@urql/core": "workspace:*",
"graphql": "^16.0.0",
"jsdom": "^22.1.0",
"vite-plugin-solid": "^2.7.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.32.2"
"vitest": "^0.30.1"
},
"peerDependencies": {
"@urql/core": "^5.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/solid-urql/src/createMutation.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @vitest-environment jsdom

import { testEffect } from '@solidjs/testing-library';
import { expect, it, describe, vi } from 'vitest';
import { CreateMutationState, createMutation } from './createMutation';
Expand Down
2 changes: 2 additions & 0 deletions packages/solid-urql/src/createQuery.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @vitest-environment jsdom

import { expect, it, describe, vi } from 'vitest';
import { CreateQueryState, createQuery } from './createQuery';
import { renderHook, testEffect } from '@solidjs/testing-library';
Expand Down
2 changes: 2 additions & 0 deletions packages/solid-urql/src/createSubscription.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @vitest-environment jsdom

import { renderHook, testEffect } from '@solidjs/testing-library';
import {
OperationResult,
Expand Down
2 changes: 2 additions & 0 deletions packages/solid-urql/src/suspense.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @vitest-environment jsdom

import { describe, it, vi } from 'vitest';
import {
OperationResult,
Expand Down
16 changes: 5 additions & 11 deletions packages/solid-urql/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import { defineConfig, mergeConfig } from 'vite';
import { mergeConfig } from 'vitest/config';
import solidPlugin from 'vite-plugin-solid';
import rootConfig from '../../vitest.config';
import baseConfig from '../../vitest.config';

export default mergeConfig(
rootConfig,
defineConfig({
plugins: [solidPlugin()],
test: {
globals: true,
},
})
);
export default mergeConfig(baseConfig, {
plugins: [solidPlugin({ hot: false })],
});
Loading

0 comments on commit 7830807

Please sign in to comment.