Skip to content

Commit

Permalink
chore(deps): update vitest monorepo to v1 (major) (#249)
Browse files Browse the repository at this point in the history
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Hezekiah Hendry <[email protected]>
Co-authored-by: DanCodes <[email protected]>
  • Loading branch information
3 people committed Apr 28, 2024
1 parent 6375cf2 commit 990fa84
Show file tree
Hide file tree
Showing 9 changed files with 678 additions and 371 deletions.
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

0 comments on commit 990fa84

Please sign in to comment.