Skip to content

Commit

Permalink
chore(deps): update dependency vitest to v3 (#467)
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: Arda TANRIKULU <[email protected]>
  • Loading branch information
renovate[bot] and ardatan authored Jan 16, 2025
1 parent 241bcc7 commit a3f232d
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 176 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/dist/index.js b/dist/index.js
index c984d3d..3fec461 100644
index e798670e0bcee619c181680665eb4d8755f49b07..09b8df1bbba3ffdb0c464ff62b9c0b3926e85cb3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1718,7 +1718,7 @@ async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
@@ -1717,7 +1717,7 @@ async function saveSnapshotFile(environment, snapshotData, snapshotPath) {
normalizeNewlines(snapshotData[key])
)};`
);
Expand All @@ -11,14 +11,14 @@ index c984d3d..3fec461 100644

${snapshots.join("\n\n")}
`;
@@ -2159,10 +2159,10 @@ class SnapshotClient {
@@ -2201,10 +2201,10 @@ class SnapshotClient {
throw err;
}
}
- const testName = [name, ...message ? [message] : []].join(" > ");
+ const testName = [name, ...message ? [message] : []].join(": ");
const snapshotState = this.getSnapshotState(filepath);
const { actual, expected, key, pass } = snapshotState.match({
testId,
- testName,
+ testName: testName.replaceAll(' >', ''),
received,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
"typescript-eslint": "^8.9.0",
"vite": "^6.0.0",
"vite-tsconfig-paths": "patch:vite-tsconfig-paths@npm%3A5.1.3#~/.yarn/patches/vite-tsconfig-paths-npm-5.1.3-1736ca1872.patch",
"vitest": "^2.1.3"
"vitest": "^3.0.1"
},
"resolutions": {
"@graphql-tools/delegate": "workspace:^",
"@opentelemetry/exporter-trace-otlp-http": "patch:@opentelemetry/exporter-trace-otlp-http@npm%3A0.56.0#~/.yarn/patches/@opentelemetry-exporter-trace-otlp-http-npm-0.56.0-dddd282e41.patch",
"@opentelemetry/otlp-exporter-base": "patch:@opentelemetry/otlp-exporter-base@npm%3A0.56.0#~/.yarn/patches/@opentelemetry-otlp-exporter-base-npm-0.56.0-ba3dc5f5c5.patch",
"@opentelemetry/resources": "patch:@opentelemetry/resources@npm%3A1.29.0#~/.yarn/patches/@opentelemetry-resources-npm-1.29.0-112f89f0c5.patch",
"@vitest/snapshot": "patch:@vitest/snapshot@npm%3A2.1.5#~/.yarn/patches/@vitest+snapshot+2.1.5.patch",
"@vitest/snapshot@npm:3.0.1": "patch:@vitest/snapshot@npm%3A3.0.1#~/.yarn/patches/@vitest-snapshot-npm-3.0.0-d5b381862b.patch",
"cross-spawn": "7.0.6",
"esbuild": "0.24.2",
"graphql": "16.10.0",
Expand Down
6 changes: 5 additions & 1 deletion packages/delegate/tests/createRequest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ describe('bare requests', () => {
data: {
delegate: null,
},
errors: [createGraphQLError('test')],
errors: [
createGraphQLError('test', {
path: ['delegate'],
}),
],
});
});
});
79 changes: 36 additions & 43 deletions packages/stitch/tests/alternateStitchSchemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { addMocksToSchema } from '@graphql-tools/mock';
import { makeExecutableSchema } from '@graphql-tools/schema';
import {
assertSome,
createGraphQLError,
ExecutionResult,
filterSchema,
} from '@graphql-tools/utils';
Expand Down Expand Up @@ -755,15 +754,14 @@ describe('transform object fields', () => {
`,
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
errors: [
createGraphQLError('Cannot query field "id" on type "Item".', {
positions: [17, 6],
}),
{
message: 'Cannot query field "id" on type "Item".',
locations: [{ line: 6, column: 17 }],
},
],
};

expect(result).toEqual(expectedResult);
});
});
});

Expand Down Expand Up @@ -840,7 +838,7 @@ type Query {
},
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: {
propertyById: {
new_id: 'p1',
Expand All @@ -852,17 +850,16 @@ type Query {
},
},
errors: [
createGraphQLError('Property.error error', {
positions: [13, 9],
{
message: 'Property.error error',
locations: [{ line: 9, column: 13 }],
path: ['propertyById', 'new_error'],
extensions: {
code: 'SOME_CUSTOM_CODE',
},
}),
},
],
};

expect(result).toEqual(expectedResult);
});
});
});

Expand Down Expand Up @@ -1009,7 +1006,7 @@ describe('WrapType', () => {
},
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: {
namespace: {
bookingById: {
Expand All @@ -1021,14 +1018,13 @@ describe('WrapType', () => {
},
},
errors: [
createGraphQLError('Booking.error error', {
positions: [15, 8],
{
message: 'Booking.error error',
locations: [{ line: 8, column: 15 }],
path: ['namespace', 'bookingById', 'error'],
}),
},
],
};

expect(result).toEqual(expectedResult);
});
});

test('Mutation transform should work', async () => {
Expand Down Expand Up @@ -1061,7 +1057,7 @@ describe('WrapType', () => {
},
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: {
namespace: {
addBooking: {
Expand All @@ -1074,14 +1070,13 @@ describe('WrapType', () => {
},
},
errors: [
createGraphQLError('Booking.error error', {
positions: [15, 9],
{
message: 'Booking.error error',
locations: [{ line: 9, column: 15 }],
path: ['namespace', 'addBooking', 'error'],
}),
},
],
};

expect(result).toEqual(expectedResult);
});
});

test('Subscription transform should work', async () => {
Expand Down Expand Up @@ -1471,7 +1466,7 @@ describe('schema transformation with wrapping of object fields', () => {
},
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: {
propertyById: {
test1: {
Expand All @@ -1484,17 +1479,16 @@ describe('schema transformation with wrapping of object fields', () => {
},
},
errors: [
createGraphQLError('Property.error error', {
positions: [13, 14],
{
message: 'Property.error error',
locations: [{ line: 14, column: 13 }],
path: ['propertyById', 'test1', 'two'],
extensions: {
code: 'SOME_CUSTOM_CODE',
},
}),
},
],
};

expect(result).toEqual(expectedResult);
});
});

test('should work, even with multiple fields', async () => {
Expand Down Expand Up @@ -1540,7 +1534,7 @@ describe('schema transformation with wrapping of object fields', () => {
},
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: {
propertyById: {
test1: {
Expand All @@ -1557,17 +1551,16 @@ describe('schema transformation with wrapping of object fields', () => {
},
},
errors: [
createGraphQLError('Property.error error', {
positions: [13, 18],
{
message: 'Property.error error',
locations: [{ line: 18, column: 13 }],
path: ['propertyById', 'test1', 'innerWrap', 'two'],
extensions: {
code: 'SOME_CUSTOM_CODE',
},
}),
},
],
};

expect(result).toEqual(expectedResult);
});
});

test('should work with selectionSets', async () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/stitch/tests/errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,10 @@ describe('executor errors are propagated', () => {
},
});

expect(result.errors).toEqual([createGraphQLError('Service is down')]);
expect(result.errors).toMatchObject([
{
message: 'Service is down',
},
]);
});
});
35 changes: 20 additions & 15 deletions packages/stitch/tests/mergeFailures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ describe('merge failures', () => {

const expectedResult: ExecutionResult = {
data: { thing: null },
errors: [createGraphQLError('unable to produce the thing')],
errors: [
createGraphQLError('unable to produce the thing', {
path: ['thing', 'description'],
}),
],
};

expect(result).toEqual(expectedResult);
Expand Down Expand Up @@ -191,16 +195,16 @@ describe('merge failures', () => {
`,
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: { thing: null },
errors: [
createGraphQLError(
'Cannot return null for non-nullable field Thing.description.',
),
{
message:
'Cannot return null for non-nullable field Thing.description.',
path: ['thing', 'description'],
},
],
};

expect(result).toEqual(expectedResult);
});
});

it('proxies errors on object', async () => {
Expand Down Expand Up @@ -236,16 +240,17 @@ describe('merge failures', () => {
`,
});

const expectedResult: ExecutionResult = {
expect(result).toMatchObject({
data: { thing: null },
errors: [
createGraphQLError(
'Cannot return null for non-nullable field Thing.description.',
),
{
message:
'Cannot return null for non-nullable field Thing.description.',
path: ['thing', 'description'],
locations: [{ line: 6, column: 13 }],
},
],
};

expect(result).toEqual(expectedResult);
});
});
});

Expand Down
12 changes: 8 additions & 4 deletions packages/stitch/tests/stitchSchemas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,10 +875,11 @@ bookingById(id: "b1") {
},
} as any,
errors: [
createGraphQLError('subscription field error', {
positions: [4, 15],
{
message: 'subscription field error',
locations: [{ line: 4, column: 15 }],
path: ['notifications', 'throwError'],
}),
},
],
};

Expand All @@ -903,7 +904,10 @@ bookingById(id: "b1") {
mockNotification,
);

expect(await payload).toEqual({ done: false, value: expectedResult });
expect(await payload).toMatchObject({
done: false,
value: expectedResult,
});
});

test('links in queries', async () => {
Expand Down
20 changes: 13 additions & 7 deletions packages/wrap/tests/transforms.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
delegateToSchema,
} from '@graphql-tools/delegate';
import { makeExecutableSchema } from '@graphql-tools/schema';
import { createGraphQLError } from '@graphql-tools/utils';
import {
ExtractField,
TransformQuery,
Expand Down Expand Up @@ -145,7 +144,9 @@ describe('transforms', () => {
schema,
source: query,
});
expect(originalResult).toEqual(transformedResult);
expect(JSON.parse(JSON.stringify(originalResult))).toMatchObject(
JSON.parse(JSON.stringify(transformedResult)),
);
});
});

Expand Down Expand Up @@ -657,17 +658,18 @@ describe('transforms', () => {
fieldResolver: defaultMergedResolver,
});

expect(result).toEqual({
expect(result).toMatchObject({
data: {
addressByUser: {
errorTest: null,
},
},
errors: [
createGraphQLError('Test Error!', {
positions: [15, 4],
{
message: 'Test Error!',
path: ['addressByUser', 'errorTest'],
}),
locations: [{ line: 4, column: 15 }],
},
],
});
});
Expand All @@ -689,7 +691,11 @@ describe('transforms', () => {
data: {
errorTest: null,
},
errors: [new Error('Test Error!')],
errors: [
{
message: 'Test Error!',
},
],
});
});

Expand Down
Loading

0 comments on commit a3f232d

Please sign in to comment.