Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update vitest monorepo to v1 (major) #249

Merged
merged 4 commits into from
Apr 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/prompts": "^2.4.9",
"@typescript-eslint/eslint-plugin": "^7.7.1",
"@typescript-eslint/parser": "^7.7.1",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/coverage-v8": "^1.5.2",
"colorette": "^2.0.20",
"esbuild-plugin-version-injector": "^1.2.1",
"eslint": "^8.57.0",
Expand All @@ -45,7 +45,7 @@
"tsup": "^8.0.2",
"turbo": "^1.13.3",
"typescript": "^5.4.5",
"vitest": "^0.34.6"
"vitest": "^1.5.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/auto-ensure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@vitest/coverage-c8": "^0.33.0",
"typedoc": "^0.25.13",
"typedoc-json-parser": "^9.0.1",
"vitest": "^0.34.6"
"vitest": "^1.5.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@vitest/coverage-c8": "^0.33.0",
"typedoc": "^0.25.13",
"typedoc-json-parser": "^9.0.1",
"vitest": "^0.34.6"
"vitest": "^1.5.2"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion packages/schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@vitest/coverage-c8": "^0.33.0",
"typedoc": "^0.25.13",
"typedoc-json-parser": "^9.0.1",
"vitest": "^0.34.6"
"vitest": "^1.5.2"
},
"repository": {
"type": "git",
Expand Down
58 changes: 30 additions & 28 deletions packages/schema/tests/lib/SchemaMiddleware.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,42 +323,44 @@ describe('SchemaMiddleware', () => {
path: [],
value: { str: 'test', num: 1, arr: [] }
});
});

test('GIVEN valid data THEN passes', async () => {
await store.provider[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 'test', num: 1, arr: [] } });
test('GIVEN valid data THEN passes', async () => {
await store.provider[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 'test', num: 1, arr: [] } });

await expect(schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: ['str'], value: 'test' })).resolves.toStrictEqual({
method: Method.Set,
errors: [],
key: 'key',
path: ['str'],
value: 'test'
});
await expect(schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: ['str'], value: 'test' })).resolves.toStrictEqual({
method: Method.Set,
errors: [],
key: 'key',
path: ['str'],
value: 'test'
});
});

test('GIVEN invalid data THEN throws', async () => {
await store.provider[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 1, num: 'test', arr: [] } });
test('GIVEN invalid data THEN throws', async () => {
await store.provider[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 1, num: 'test', arr: [] } });

const payload = await schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: ['str'], value: 'test' });
const { method, key, path, errors } = payload;
const { context } = errors[0];
const payload = await schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: ['str'], value: 'test' });
const { method, key, path, errors } = payload;
const { context } = errors[0];

expect(method).toBe(Method.Set);
expect(key).toBe('key');
expect(path).toStrictEqual(['str']);
expect(context.shapeshiftError).toBeInstanceOf(CombinedPropertyError);
});
expect(method).toBe(Method.Set);
expect(key).toBe('key');
expect(path).toStrictEqual(['str']);
expect(context.shapeshiftError).toBeInstanceOf(CombinedPropertyError);
});

test('GIVEN invalid value THEN throws', async () => {
const payload = await schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 1, num: 'test', arr: [] } });
const { method, key, path, errors } = payload;
const { context } = errors[0];
test('GIVEN invalid value THEN throws', async () => {
await store.provider[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 'test', num: 1, arr: [] } });

expect(method).toBe(Method.Set);
expect(key).toBe('key');
expect(path).toStrictEqual([]);
expect(context.shapeshiftError).toBeInstanceOf(CombinedPropertyError);
});
const payload = await schema[Method.Set]({ method: Method.Set, errors: [], key: 'key', path: [], value: { str: 1, num: 'test', arr: [] } });
const { method, key, path, errors } = payload;
const { context } = errors[0];

expect(method).toBe(Method.Set);
expect(key).toBe('key');
expect(path).toStrictEqual([]);
expect(context.shapeshiftError).toBeInstanceOf(CombinedPropertyError);
});

describe(Method.SetMany, () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@vitest/coverage-c8": "^0.33.0",
"typedoc": "^0.25.13",
"typedoc-json-parser": "^9.0.1",
"vitest": "^0.34.6"
"vitest": "^1.5.2"
},
"repository": {
"type": "git",
Expand Down
8 changes: 2 additions & 6 deletions scripts/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
import type { ESBuildOptions } from 'vite';
import { defineConfig, UserConfig } from 'vitest/config';
import { UserConfig, configDefaults, defineConfig } from 'vitest/config';

export const createVitestConfig = (options: UserConfig = {}) =>
defineConfig({
...options,
test: {
...options?.test,
deps: {
inline: [/^(?!.*vitest).*$/]
},
globals: true,
coverage: {
...options.test?.coverage,
enabled: true,
reporter: ['text', 'lcov', 'clover'],
exclude: [...(options.test?.coverage?.exclude ?? []), '**/node_modules/**', '**/dist/**', '**/tests/**']
exclude: [...(options.test?.coverage?.exclude ?? []), ...configDefaults.exclude, '**/tests/**', '**/.yarn/**', '**/scripts/**']
}
},
esbuild: {
Expand Down
5 changes: 0 additions & 5 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { createVitestConfig } from './scripts/vitest.config';

export default createVitestConfig({
test: {
deps: {
inline: [/^(?!.*vitest).*$/]
}
},
esbuild: {
target: 'es2022'
}
Expand Down
Loading