@graphql-codegen/testing 1.18.1 → 1.18.3-alpha-20230119005601-97616e3d7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +5 -5
- package/cjs/mock-graphql-server.js +1 -1
- package/cjs/resolvers-common.js +2 -2
- package/cjs/typescript.js +4 -4
- package/esm/index.js +5 -5
- package/esm/mock-graphql-server.js +1 -1
- package/esm/resolvers-common.js +2 -2
- package/esm/typescript.js +5 -5
- package/package.json +3 -3
- package/typings/index.d.cts +2 -2
- package/typings/index.d.ts +2 -2
package/cjs/index.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMonorepo = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const common_tags_1 = require("common-tags");
|
|
6
|
-
const path_1 = require("path");
|
|
7
5
|
const fs_1 = require("fs");
|
|
8
|
-
const
|
|
6
|
+
const path_1 = require("path");
|
|
9
7
|
const globals_1 = require("@jest/globals");
|
|
8
|
+
const common_tags_1 = require("common-tags");
|
|
9
|
+
const jest_diff_1 = require("jest-diff");
|
|
10
10
|
function compareStrings(a, b) {
|
|
11
11
|
return a.includes(b);
|
|
12
12
|
}
|
|
@@ -26,7 +26,7 @@ globals_1.expect.extend({
|
|
|
26
26
|
const diffString = (0, jest_diff_1.diff)((0, common_tags_1.stripIndent) `${expected}`, (0, common_tags_1.stripIndent) `${received}`, {
|
|
27
27
|
expand: this.expand,
|
|
28
28
|
});
|
|
29
|
-
const hasExpect = diffString
|
|
29
|
+
const hasExpect = diffString === null || diffString === void 0 ? void 0 : diffString.includes('- Expect');
|
|
30
30
|
const message = hasExpect
|
|
31
31
|
? `Difference:\n\n${diffString}`
|
|
32
32
|
: `expected
|
|
@@ -71,6 +71,6 @@ function useMonorepo({ dirname }) {
|
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
73
|
exports.useMonorepo = useMonorepo;
|
|
74
|
-
tslib_1.__exportStar(require("./typescript.js"), exports);
|
|
75
74
|
tslib_1.__exportStar(require("./mock-graphql-server.js"), exports);
|
|
76
75
|
tslib_1.__exportStar(require("./resolvers-common.js"), exports);
|
|
76
|
+
tslib_1.__exportStar(require("./typescript.js"), exports);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mockGraphQLServer = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const nock_1 = tslib_1.__importDefault(require("nock"));
|
|
6
5
|
const graphql_helix_1 = require("graphql-helix");
|
|
6
|
+
const nock_1 = tslib_1.__importDefault(require("nock"));
|
|
7
7
|
function mockGraphQLServer({ schema, host, path, intercept, method = 'POST', }) {
|
|
8
8
|
const handler = async function (uri, body) {
|
|
9
9
|
if (intercept) {
|
package/cjs/resolvers-common.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolversTestingValidate = exports.resolversTestingSchema = void 0;
|
|
4
|
-
const testing_1 = require("@graphql-codegen/testing");
|
|
5
4
|
const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
|
|
6
|
-
const
|
|
5
|
+
const testing_1 = require("@graphql-codegen/testing");
|
|
7
6
|
const typescript_1 = require("@graphql-codegen/typescript");
|
|
7
|
+
const graphql_1 = require("graphql");
|
|
8
8
|
exports.resolversTestingSchema = (0, graphql_1.buildSchema)(/* GraphQL */ `
|
|
9
9
|
type MyType {
|
|
10
10
|
foo: String! @authenticated
|
package/cjs/typescript.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compileTs = exports.validateTs = void 0;
|
|
4
|
-
const typescript_1 = require("typescript");
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
const lz_string_1 = require("lz-string");
|
|
6
|
+
const typescript_1 = require("typescript");
|
|
7
7
|
function validateTs(pluginOutput, options = {
|
|
8
8
|
noEmitOnError: true,
|
|
9
9
|
noImplicitAny: true,
|
|
@@ -75,7 +75,7 @@ function validateTs(pluginOutput, options = {
|
|
|
75
75
|
${contents.split('\n')[line]}`);
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
errors.push(
|
|
78
|
+
errors.push(String((0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')));
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -91,7 +91,7 @@ function validateTs(pluginOutput, options = {
|
|
|
91
91
|
${contents.split('\n')[line]}`);
|
|
92
92
|
}
|
|
93
93
|
else {
|
|
94
|
-
errors.push(
|
|
94
|
+
errors.push(String((0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')));
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
97
|
}
|
|
@@ -172,7 +172,7 @@ function compileTs(contents, options = {
|
|
|
172
172
|
${contents.split('\n')[line]}`);
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
errors.push(
|
|
175
|
+
errors.push(String((0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')));
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
|
package/esm/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { oneLine, stripIndent } from 'common-tags';
|
|
2
|
-
import { resolve } from 'path';
|
|
3
1
|
import { existsSync } from 'fs';
|
|
4
|
-
import {
|
|
2
|
+
import { resolve } from 'path';
|
|
5
3
|
import { expect } from '@jest/globals';
|
|
4
|
+
import { oneLine, stripIndent } from 'common-tags';
|
|
5
|
+
import { diff } from 'jest-diff';
|
|
6
6
|
function compareStrings(a, b) {
|
|
7
7
|
return a.includes(b);
|
|
8
8
|
}
|
|
@@ -22,7 +22,7 @@ expect.extend({
|
|
|
22
22
|
const diffString = diff(stripIndent `${expected}`, stripIndent `${received}`, {
|
|
23
23
|
expand: this.expand,
|
|
24
24
|
});
|
|
25
|
-
const hasExpect = diffString
|
|
25
|
+
const hasExpect = diffString === null || diffString === void 0 ? void 0 : diffString.includes('- Expect');
|
|
26
26
|
const message = hasExpect
|
|
27
27
|
? `Difference:\n\n${diffString}`
|
|
28
28
|
: `expected
|
|
@@ -66,6 +66,6 @@ export function useMonorepo({ dirname }) {
|
|
|
66
66
|
},
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
export * from './typescript.js';
|
|
70
69
|
export * from './mock-graphql-server.js';
|
|
71
70
|
export * from './resolvers-common.js';
|
|
71
|
+
export * from './typescript.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import nock from 'nock';
|
|
2
1
|
import { getGraphQLParameters, processRequest as processGraphQLHelixRequest } from 'graphql-helix';
|
|
2
|
+
import nock from 'nock';
|
|
3
3
|
export function mockGraphQLServer({ schema, host, path, intercept, method = 'POST', }) {
|
|
4
4
|
const handler = async function (uri, body) {
|
|
5
5
|
if (intercept) {
|
package/esm/resolvers-common.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { validateTs } from '@graphql-codegen/testing';
|
|
2
1
|
import { mergeOutputs } from '@graphql-codegen/plugin-helpers';
|
|
3
|
-
import {
|
|
2
|
+
import { validateTs } from '@graphql-codegen/testing';
|
|
4
3
|
import { plugin as tsPlugin } from '@graphql-codegen/typescript';
|
|
4
|
+
import { buildSchema } from 'graphql';
|
|
5
5
|
export const resolversTestingSchema = buildSchema(/* GraphQL */ `
|
|
6
6
|
type MyType {
|
|
7
7
|
foo: String! @authenticated
|
package/esm/typescript.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { resolve, join, dirname } from 'path';
|
|
1
|
+
import { dirname, join, resolve } from 'path';
|
|
3
2
|
import { compressToEncodedURIComponent } from 'lz-string';
|
|
3
|
+
import { createCompilerHost, createProgram, createSourceFile, flattenDiagnosticMessageText, JsxEmit, ModuleKind, ModuleResolutionKind, ScriptKind, ScriptTarget, } from 'typescript';
|
|
4
4
|
export function validateTs(pluginOutput, options = {
|
|
5
5
|
noEmitOnError: true,
|
|
6
6
|
noImplicitAny: true,
|
|
@@ -72,7 +72,7 @@ export function validateTs(pluginOutput, options = {
|
|
|
72
72
|
${contents.split('\n')[line]}`);
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
75
|
-
errors.push(
|
|
75
|
+
errors.push(String(flattenDiagnosticMessageText(diagnostic.messageText, '\n')));
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -88,7 +88,7 @@ export function validateTs(pluginOutput, options = {
|
|
|
88
88
|
${contents.split('\n')[line]}`);
|
|
89
89
|
}
|
|
90
90
|
else {
|
|
91
|
-
errors.push(
|
|
91
|
+
errors.push(String(flattenDiagnosticMessageText(diagnostic.messageText, '\n')));
|
|
92
92
|
}
|
|
93
93
|
});
|
|
94
94
|
}
|
|
@@ -168,7 +168,7 @@ export function compileTs(contents, options = {
|
|
|
168
168
|
${contents.split('\n')[line]}`);
|
|
169
169
|
}
|
|
170
170
|
else {
|
|
171
|
-
errors.push(
|
|
171
|
+
errors.push(String(flattenDiagnosticMessageText(diagnostic.messageText, '\n')));
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-codegen/testing",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.3-alpha-20230119005601-97616e3d7",
|
|
4
4
|
"description": "GraphQL Codegen Testing Utils",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"jest-diff": "^23.0.0 || ^24.0.0 || ^25.0.0 || ^26.0.0 || ^27.0.0 || ^28.0.0",
|
|
7
7
|
"typescript": ">=3.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@graphql-codegen/plugin-helpers": "^3.
|
|
10
|
+
"@graphql-codegen/plugin-helpers": "^3.1.1",
|
|
11
11
|
"common-tags": "^1.8.0",
|
|
12
12
|
"lz-string": "^1.4.4",
|
|
13
13
|
"graphql-helix": "1.13.0",
|
|
14
|
-
"nock": "13.
|
|
14
|
+
"nock": "13.3.0",
|
|
15
15
|
"tslib": "~2.4.0"
|
|
16
16
|
},
|
|
17
17
|
"repository": "git@github.com:dotansimha/graphql-code-generator.git",
|
package/typings/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace jest {
|
|
3
|
-
interface Matchers<R
|
|
3
|
+
interface Matchers<R> {
|
|
4
4
|
/**
|
|
5
5
|
* Normalizes whitespace and performs string comparisons
|
|
6
6
|
*/
|
|
@@ -13,6 +13,6 @@ export declare function useMonorepo({ dirname }: {
|
|
|
13
13
|
}): {
|
|
14
14
|
correctCWD(): void;
|
|
15
15
|
};
|
|
16
|
-
export * from './typescript.cjs';
|
|
17
16
|
export * from './mock-graphql-server.cjs';
|
|
18
17
|
export * from './resolvers-common.cjs';
|
|
18
|
+
export * from './typescript.cjs';
|
package/typings/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace jest {
|
|
3
|
-
interface Matchers<R
|
|
3
|
+
interface Matchers<R> {
|
|
4
4
|
/**
|
|
5
5
|
* Normalizes whitespace and performs string comparisons
|
|
6
6
|
*/
|
|
@@ -13,6 +13,6 @@ export declare function useMonorepo({ dirname }: {
|
|
|
13
13
|
}): {
|
|
14
14
|
correctCWD(): void;
|
|
15
15
|
};
|
|
16
|
-
export * from './typescript.js';
|
|
17
16
|
export * from './mock-graphql-server.js';
|
|
18
17
|
export * from './resolvers-common.js';
|
|
18
|
+
export * from './typescript.js';
|