@graphql-codegen/testing 1.17.8-alpha-dd1d7ffc.0 → 1.18.0-alpha-20221101142840-b5a6a91f6

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 ADDED
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useMonorepo = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const common_tags_1 = require("common-tags");
6
+ const path_1 = require("path");
7
+ const fs_1 = require("fs");
8
+ const jest_diff_1 = require("jest-diff");
9
+ const globals_1 = require("@jest/globals");
10
+ function compareStrings(a, b) {
11
+ return a.includes(b);
12
+ }
13
+ globals_1.expect.extend({
14
+ toBeSimilarStringTo(received, expected) {
15
+ const strippedReceived = (0, common_tags_1.oneLine) `${received}`.replace(/\s\s+/g, ' ');
16
+ const strippedExpected = (0, common_tags_1.oneLine) `${expected}`.replace(/\s\s+/g, ' ');
17
+ if (compareStrings(strippedReceived, strippedExpected)) {
18
+ return {
19
+ message: () => `expected
20
+ ${received}
21
+ not to be a string containing (ignoring indents)
22
+ ${expected}`,
23
+ pass: true,
24
+ };
25
+ }
26
+ const diffString = (0, jest_diff_1.diff)((0, common_tags_1.stripIndent) `${expected}`, (0, common_tags_1.stripIndent) `${received}`, {
27
+ expand: this.expand,
28
+ });
29
+ const hasExpect = diffString && diffString.includes('- Expect');
30
+ const message = hasExpect
31
+ ? `Difference:\n\n${diffString}`
32
+ : `expected
33
+ ${received}
34
+ to be a string containing (ignoring indents)
35
+ ${expected}`;
36
+ return {
37
+ message: () => message,
38
+ pass: false,
39
+ };
40
+ },
41
+ });
42
+ function findProjectDir(dirname) {
43
+ const originalDirname = dirname;
44
+ const cwd = process.cwd();
45
+ const stopDir = (0, path_1.resolve)(cwd, '..');
46
+ while (dirname !== stopDir) {
47
+ try {
48
+ if ((0, fs_1.existsSync)((0, path_1.resolve)(dirname, 'package.json'))) {
49
+ return dirname;
50
+ }
51
+ dirname = (0, path_1.resolve)(dirname, '..');
52
+ }
53
+ catch (e) {
54
+ // ignore
55
+ }
56
+ }
57
+ throw new Error(`Coudn't find project's root from: ${originalDirname}`);
58
+ }
59
+ function useMonorepo({ dirname }) {
60
+ const cwd = findProjectDir(dirname);
61
+ return {
62
+ correctCWD() {
63
+ let spyProcessCwd;
64
+ beforeEach(() => {
65
+ spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);
66
+ });
67
+ afterEach(() => {
68
+ spyProcessCwd.mockRestore();
69
+ });
70
+ },
71
+ };
72
+ }
73
+ exports.useMonorepo = useMonorepo;
74
+ tslib_1.__exportStar(require("./typescript.js"), exports);
75
+ tslib_1.__exportStar(require("./mock-graphql-server.js"), exports);
76
+ tslib_1.__exportStar(require("./resolvers-common.js"), exports);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockGraphQLServer = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const nock_1 = tslib_1.__importDefault(require("nock"));
6
+ const graphql_helix_1 = require("graphql-helix");
7
+ function mockGraphQLServer({ schema, host, path, intercept, method = 'POST', }) {
8
+ const handler = async function (uri, body) {
9
+ if (intercept) {
10
+ intercept(this);
11
+ }
12
+ const uriObj = new URL(host + uri);
13
+ const queryObj = {};
14
+ uriObj.searchParams.forEach((val, key) => (queryObj[key] = val));
15
+ // Create a generic Request object that can be consumed by Graphql Helix's API
16
+ const request = {
17
+ body,
18
+ headers: this.req.headers,
19
+ method,
20
+ query: queryObj,
21
+ };
22
+ // Extract the GraphQL parameters from the request
23
+ const { operationName, query, variables } = (0, graphql_helix_1.getGraphQLParameters)(request);
24
+ // Validate and execute the query
25
+ const result = await (0, graphql_helix_1.processRequest)({
26
+ operationName,
27
+ query,
28
+ variables,
29
+ request,
30
+ schema,
31
+ });
32
+ // processRequest returns one of three types of results depending on how the server should respond
33
+ // 1) RESPONSE: a regular JSON payload
34
+ // 2) MULTIPART RESPONSE: a multipart response (when @stream or @defer directives are used)
35
+ // 3) PUSH: a stream of events to push back down the client for a subscription
36
+ if (result.type === 'RESPONSE') {
37
+ const headers = {};
38
+ // We set the provided status and headers and just the send the payload back to the client
39
+ result.headers.forEach(({ name, value }) => (headers[name] = value));
40
+ return [result.status, result.payload, headers];
41
+ }
42
+ return [500, 'Not implemented'];
43
+ };
44
+ switch (method) {
45
+ case 'GET':
46
+ return (0, nock_1.default)(host).get(path).reply(handler);
47
+ case 'POST':
48
+ return (0, nock_1.default)(host).post(path).reply(handler);
49
+ }
50
+ return null;
51
+ }
52
+ exports.mockGraphQLServer = mockGraphQLServer;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.resolversTestingValidate = exports.resolversTestingSchema = void 0;
4
+ const testing_1 = require("@graphql-codegen/testing");
5
+ const plugin_helpers_1 = require("@graphql-codegen/plugin-helpers");
6
+ const graphql_1 = require("graphql");
7
+ const typescript_1 = require("@graphql-codegen/typescript");
8
+ exports.resolversTestingSchema = (0, graphql_1.buildSchema)(/* GraphQL */ `
9
+ type MyType {
10
+ foo: String! @authenticated
11
+ otherType: MyOtherType
12
+ withArgs(arg: String, arg2: String!): String
13
+ unionChild: ChildUnion
14
+ }
15
+
16
+ type Child {
17
+ bar: String!
18
+ parent: MyType
19
+ }
20
+
21
+ type MyOtherType {
22
+ bar: String!
23
+ }
24
+
25
+ union ChildUnion = Child | MyOtherType
26
+
27
+ type Query {
28
+ something: MyType!
29
+ }
30
+
31
+ type Subscription {
32
+ somethingChanged: MyOtherType
33
+ }
34
+
35
+ interface Node {
36
+ id: ID!
37
+ }
38
+
39
+ type SomeNode implements Node {
40
+ id: ID!
41
+ }
42
+
43
+ union MyUnion = MyType | MyOtherType
44
+
45
+ scalar MyScalar
46
+
47
+ directive @myDirective(arg: Int!, arg2: String!, arg3: Boolean!) on FIELD
48
+ directive @authenticated on FIELD_DEFINITION
49
+ `);
50
+ const resolversTestingValidate = async (content, config = {}, pluginSchema = exports.resolversTestingSchema, additionalCode = '') => {
51
+ const mergedContent = (0, plugin_helpers_1.mergeOutputs)([
52
+ await (0, typescript_1.plugin)(pluginSchema, [], config, { outputFile: '' }),
53
+ content,
54
+ additionalCode,
55
+ ]);
56
+ (0, testing_1.validateTs)(mergedContent);
57
+ return mergedContent;
58
+ };
59
+ exports.resolversTestingValidate = resolversTestingValidate;
@@ -0,0 +1,191 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compileTs = exports.validateTs = void 0;
4
+ const typescript_1 = require("typescript");
5
+ const path_1 = require("path");
6
+ const lz_string_1 = require("lz-string");
7
+ function validateTs(pluginOutput, options = {
8
+ noEmitOnError: true,
9
+ noImplicitAny: true,
10
+ moduleResolution: typescript_1.ModuleResolutionKind.NodeJs,
11
+ experimentalDecorators: true,
12
+ emitDecoratorMetadata: true,
13
+ target: typescript_1.ScriptTarget.ES5,
14
+ typeRoots: [(0, path_1.resolve)(require.resolve('typescript'), '../../../@types/')],
15
+ jsx: typescript_1.JsxEmit.React,
16
+ allowJs: true,
17
+ skipLibCheck: true,
18
+ lib: [
19
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es5.d.ts'),
20
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es6.d.ts'),
21
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.dom.d.ts'),
22
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.scripthost.d.ts'),
23
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es2015.d.ts'),
24
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.esnext.d.ts'),
25
+ ],
26
+ module: typescript_1.ModuleKind.ESNext,
27
+ }, isTsx = false, isStrict = false, suspenseErrors = [], compileProgram = false) {
28
+ if (process.env.SKIP_VALIDATION) {
29
+ return;
30
+ }
31
+ if (isStrict) {
32
+ options.strictNullChecks = true;
33
+ options.strict = true;
34
+ options.strictBindCallApply = true;
35
+ options.strictPropertyInitialization = true;
36
+ options.alwaysStrict = true;
37
+ options.strictFunctionTypes = true;
38
+ }
39
+ const contents = typeof pluginOutput === 'string'
40
+ ? pluginOutput
41
+ : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\n');
42
+ const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
43
+ const errors = [];
44
+ if (compileProgram) {
45
+ const host = (0, typescript_1.createCompilerHost)(options);
46
+ const program = (0, typescript_1.createProgram)([testFile], options, {
47
+ ...host,
48
+ getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
49
+ if (fileName === testFile) {
50
+ return (0, typescript_1.createSourceFile)(fileName, contents, options.target);
51
+ }
52
+ return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
53
+ },
54
+ writeFile() { },
55
+ useCaseSensitiveFileNames() {
56
+ return false;
57
+ },
58
+ getCanonicalFileName(filename) {
59
+ return filename;
60
+ },
61
+ getCurrentDirectory() {
62
+ return '';
63
+ },
64
+ getNewLine() {
65
+ return '\n';
66
+ },
67
+ });
68
+ const emitResult = program.emit();
69
+ const allDiagnostics = emitResult.diagnostics;
70
+ allDiagnostics.forEach(diagnostic => {
71
+ if (diagnostic.file) {
72
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
73
+ const message = (0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n');
74
+ errors.push(`${line + 1},${character + 1}: ${message} ->
75
+ ${contents.split('\n')[line]}`);
76
+ }
77
+ else {
78
+ errors.push(`${(0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')}`);
79
+ }
80
+ });
81
+ }
82
+ else {
83
+ const result = (0, typescript_1.createSourceFile)(testFile, contents, typescript_1.ScriptTarget.ES2016, false, isTsx ? typescript_1.ScriptKind.TSX : undefined);
84
+ const allDiagnostics = result.parseDiagnostics;
85
+ if (allDiagnostics && allDiagnostics.length > 0) {
86
+ allDiagnostics.forEach(diagnostic => {
87
+ if (diagnostic.file) {
88
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
89
+ const message = (0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n');
90
+ errors.push(`${line + 1},${character + 1}: ${message} ->
91
+ ${contents.split('\n')[line]}`);
92
+ }
93
+ else {
94
+ errors.push(`${(0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')}`);
95
+ }
96
+ });
97
+ }
98
+ }
99
+ const relevantErrors = errors.filter(e => {
100
+ if (e.includes('Cannot find module')) {
101
+ return false;
102
+ }
103
+ for (const suspenseError of suspenseErrors) {
104
+ if (e.includes(suspenseError)) {
105
+ return false;
106
+ }
107
+ }
108
+ return true;
109
+ });
110
+ if (relevantErrors && relevantErrors.length > 0) {
111
+ throw new Error(relevantErrors.join('\n'));
112
+ }
113
+ }
114
+ exports.validateTs = validateTs;
115
+ function compileTs(contents, options = {
116
+ noEmitOnError: true,
117
+ noImplicitAny: true,
118
+ moduleResolution: typescript_1.ModuleResolutionKind.NodeJs,
119
+ allowSyntheticDefaultImports: true,
120
+ experimentalDecorators: true,
121
+ emitDecoratorMetadata: true,
122
+ target: typescript_1.ScriptTarget.ES5,
123
+ typeRoots: [(0, path_1.resolve)(require.resolve('typescript'), '../../../@types/')],
124
+ jsx: typescript_1.JsxEmit.Preserve,
125
+ allowJs: true,
126
+ lib: [
127
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es5.d.ts'),
128
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es6.d.ts'),
129
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.dom.d.ts'),
130
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.scripthost.d.ts'),
131
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.es2015.d.ts'),
132
+ (0, path_1.join)((0, path_1.dirname)(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),
133
+ ],
134
+ module: typescript_1.ModuleKind.ESNext,
135
+ }, isTsx = false, openPlayground = false) {
136
+ if (process.env.SKIP_VALIDATION) {
137
+ return;
138
+ }
139
+ try {
140
+ const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
141
+ const host = (0, typescript_1.createCompilerHost)(options);
142
+ const program = (0, typescript_1.createProgram)([testFile], options, {
143
+ ...host,
144
+ getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
145
+ if (fileName === testFile) {
146
+ return (0, typescript_1.createSourceFile)(fileName, contents, options.target);
147
+ }
148
+ return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
149
+ },
150
+ writeFile() { },
151
+ useCaseSensitiveFileNames() {
152
+ return false;
153
+ },
154
+ getCanonicalFileName(filename) {
155
+ return filename;
156
+ },
157
+ getCurrentDirectory() {
158
+ return '';
159
+ },
160
+ getNewLine() {
161
+ return '\n';
162
+ },
163
+ });
164
+ const emitResult = program.emit();
165
+ const allDiagnostics = emitResult.diagnostics;
166
+ const errors = [];
167
+ allDiagnostics.forEach(diagnostic => {
168
+ if (diagnostic.file) {
169
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
170
+ const message = (0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n');
171
+ errors.push(`${line + 1},${character + 1}: ${message} ->
172
+ ${contents.split('\n')[line]}`);
173
+ }
174
+ else {
175
+ errors.push(`${(0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n')}`);
176
+ }
177
+ });
178
+ const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
179
+ if (relevantErrors && relevantErrors.length > 0) {
180
+ throw new Error(relevantErrors.join('\n'));
181
+ }
182
+ }
183
+ catch (e) {
184
+ if (openPlayground) {
185
+ const compressedCode = (0, lz_string_1.compressToEncodedURIComponent)(contents);
186
+ open('http://www.typescriptlang.org/play/#code/' + compressedCode);
187
+ }
188
+ throw e;
189
+ }
190
+ }
191
+ exports.compileTs = compileTs;
package/esm/index.js ADDED
@@ -0,0 +1,71 @@
1
+ import { oneLine, stripIndent } from 'common-tags';
2
+ import { resolve } from 'path';
3
+ import { existsSync } from 'fs';
4
+ import { diff } from 'jest-diff';
5
+ import { expect } from '@jest/globals';
6
+ function compareStrings(a, b) {
7
+ return a.includes(b);
8
+ }
9
+ expect.extend({
10
+ toBeSimilarStringTo(received, expected) {
11
+ const strippedReceived = oneLine `${received}`.replace(/\s\s+/g, ' ');
12
+ const strippedExpected = oneLine `${expected}`.replace(/\s\s+/g, ' ');
13
+ if (compareStrings(strippedReceived, strippedExpected)) {
14
+ return {
15
+ message: () => `expected
16
+ ${received}
17
+ not to be a string containing (ignoring indents)
18
+ ${expected}`,
19
+ pass: true,
20
+ };
21
+ }
22
+ const diffString = diff(stripIndent `${expected}`, stripIndent `${received}`, {
23
+ expand: this.expand,
24
+ });
25
+ const hasExpect = diffString && diffString.includes('- Expect');
26
+ const message = hasExpect
27
+ ? `Difference:\n\n${diffString}`
28
+ : `expected
29
+ ${received}
30
+ to be a string containing (ignoring indents)
31
+ ${expected}`;
32
+ return {
33
+ message: () => message,
34
+ pass: false,
35
+ };
36
+ },
37
+ });
38
+ function findProjectDir(dirname) {
39
+ const originalDirname = dirname;
40
+ const cwd = process.cwd();
41
+ const stopDir = resolve(cwd, '..');
42
+ while (dirname !== stopDir) {
43
+ try {
44
+ if (existsSync(resolve(dirname, 'package.json'))) {
45
+ return dirname;
46
+ }
47
+ dirname = resolve(dirname, '..');
48
+ }
49
+ catch (e) {
50
+ // ignore
51
+ }
52
+ }
53
+ throw new Error(`Coudn't find project's root from: ${originalDirname}`);
54
+ }
55
+ export function useMonorepo({ dirname }) {
56
+ const cwd = findProjectDir(dirname);
57
+ return {
58
+ correctCWD() {
59
+ let spyProcessCwd;
60
+ beforeEach(() => {
61
+ spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);
62
+ });
63
+ afterEach(() => {
64
+ spyProcessCwd.mockRestore();
65
+ });
66
+ },
67
+ };
68
+ }
69
+ export * from './typescript.js';
70
+ export * from './mock-graphql-server.js';
71
+ export * from './resolvers-common.js';
@@ -0,0 +1,47 @@
1
+ import nock from 'nock';
2
+ import { getGraphQLParameters, processRequest as processGraphQLHelixRequest } from 'graphql-helix';
3
+ export function mockGraphQLServer({ schema, host, path, intercept, method = 'POST', }) {
4
+ const handler = async function (uri, body) {
5
+ if (intercept) {
6
+ intercept(this);
7
+ }
8
+ const uriObj = new URL(host + uri);
9
+ const queryObj = {};
10
+ uriObj.searchParams.forEach((val, key) => (queryObj[key] = val));
11
+ // Create a generic Request object that can be consumed by Graphql Helix's API
12
+ const request = {
13
+ body,
14
+ headers: this.req.headers,
15
+ method,
16
+ query: queryObj,
17
+ };
18
+ // Extract the GraphQL parameters from the request
19
+ const { operationName, query, variables } = getGraphQLParameters(request);
20
+ // Validate and execute the query
21
+ const result = await processGraphQLHelixRequest({
22
+ operationName,
23
+ query,
24
+ variables,
25
+ request,
26
+ schema,
27
+ });
28
+ // processRequest returns one of three types of results depending on how the server should respond
29
+ // 1) RESPONSE: a regular JSON payload
30
+ // 2) MULTIPART RESPONSE: a multipart response (when @stream or @defer directives are used)
31
+ // 3) PUSH: a stream of events to push back down the client for a subscription
32
+ if (result.type === 'RESPONSE') {
33
+ const headers = {};
34
+ // We set the provided status and headers and just the send the payload back to the client
35
+ result.headers.forEach(({ name, value }) => (headers[name] = value));
36
+ return [result.status, result.payload, headers];
37
+ }
38
+ return [500, 'Not implemented'];
39
+ };
40
+ switch (method) {
41
+ case 'GET':
42
+ return nock(host).get(path).reply(handler);
43
+ case 'POST':
44
+ return nock(host).post(path).reply(handler);
45
+ }
46
+ return null;
47
+ }
@@ -0,0 +1,55 @@
1
+ import { validateTs } from '@graphql-codegen/testing';
2
+ import { mergeOutputs } from '@graphql-codegen/plugin-helpers';
3
+ import { buildSchema } from 'graphql';
4
+ import { plugin as tsPlugin } from '@graphql-codegen/typescript';
5
+ export const resolversTestingSchema = buildSchema(/* GraphQL */ `
6
+ type MyType {
7
+ foo: String! @authenticated
8
+ otherType: MyOtherType
9
+ withArgs(arg: String, arg2: String!): String
10
+ unionChild: ChildUnion
11
+ }
12
+
13
+ type Child {
14
+ bar: String!
15
+ parent: MyType
16
+ }
17
+
18
+ type MyOtherType {
19
+ bar: String!
20
+ }
21
+
22
+ union ChildUnion = Child | MyOtherType
23
+
24
+ type Query {
25
+ something: MyType!
26
+ }
27
+
28
+ type Subscription {
29
+ somethingChanged: MyOtherType
30
+ }
31
+
32
+ interface Node {
33
+ id: ID!
34
+ }
35
+
36
+ type SomeNode implements Node {
37
+ id: ID!
38
+ }
39
+
40
+ union MyUnion = MyType | MyOtherType
41
+
42
+ scalar MyScalar
43
+
44
+ directive @myDirective(arg: Int!, arg2: String!, arg3: Boolean!) on FIELD
45
+ directive @authenticated on FIELD_DEFINITION
46
+ `);
47
+ export const resolversTestingValidate = async (content, config = {}, pluginSchema = resolversTestingSchema, additionalCode = '') => {
48
+ const mergedContent = mergeOutputs([
49
+ await tsPlugin(pluginSchema, [], config, { outputFile: '' }),
50
+ content,
51
+ additionalCode,
52
+ ]);
53
+ validateTs(mergedContent);
54
+ return mergedContent;
55
+ };
@@ -1,12 +1,7 @@
1
- import { oneLine, stripIndent } from 'common-tags';
1
+ import { ModuleResolutionKind, ScriptTarget, JsxEmit, ModuleKind, createSourceFile, flattenDiagnosticMessageText, createCompilerHost, createProgram, ScriptKind, } from 'typescript';
2
2
  import { resolve, join, dirname } from 'path';
3
- import { existsSync } from 'fs';
4
- import diff from 'jest-diff';
5
- import { ModuleResolutionKind, ScriptTarget, JsxEmit, ModuleKind, createSourceFile, ScriptKind, flattenDiagnosticMessageText, createCompilerHost, createProgram } from 'typescript';
6
- import open from 'open';
7
-
8
- const { compressToEncodedURIComponent } = require('lz-string');
9
- function validateTs(pluginOutput, options = {
3
+ import { compressToEncodedURIComponent } from 'lz-string';
4
+ export function validateTs(pluginOutput, options = {
10
5
  noEmitOnError: true,
11
6
  noImplicitAny: true,
12
7
  moduleResolution: ModuleResolutionKind.NodeJs,
@@ -14,18 +9,19 @@ function validateTs(pluginOutput, options = {
14
9
  emitDecoratorMetadata: true,
15
10
  target: ScriptTarget.ES5,
16
11
  typeRoots: [resolve(require.resolve('typescript'), '../../../@types/')],
17
- jsx: JsxEmit.Preserve,
12
+ jsx: JsxEmit.React,
18
13
  allowJs: true,
14
+ skipLibCheck: true,
19
15
  lib: [
20
16
  join(dirname(require.resolve('typescript')), 'lib.es5.d.ts'),
21
17
  join(dirname(require.resolve('typescript')), 'lib.es6.d.ts'),
22
18
  join(dirname(require.resolve('typescript')), 'lib.dom.d.ts'),
23
19
  join(dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),
24
20
  join(dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),
25
- join(dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),
21
+ join(dirname(require.resolve('typescript')), 'lib.esnext.d.ts'),
26
22
  ],
27
23
  module: ModuleKind.ESNext,
28
- }, isTsx = false, isStrict = false, openPlayground = false) {
24
+ }, isTsx = false, isStrict = false, suspenseErrors = [], compileProgram = false) {
29
25
  if (process.env.SKIP_VALIDATION) {
30
26
  return;
31
27
  }
@@ -40,38 +36,79 @@ function validateTs(pluginOutput, options = {
40
36
  const contents = typeof pluginOutput === 'string'
41
37
  ? pluginOutput
42
38
  : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\n');
43
- try {
44
- const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
39
+ const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
40
+ const errors = [];
41
+ if (compileProgram) {
42
+ const host = createCompilerHost(options);
43
+ const program = createProgram([testFile], options, {
44
+ ...host,
45
+ getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
46
+ if (fileName === testFile) {
47
+ return createSourceFile(fileName, contents, options.target);
48
+ }
49
+ return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
50
+ },
51
+ writeFile() { },
52
+ useCaseSensitiveFileNames() {
53
+ return false;
54
+ },
55
+ getCanonicalFileName(filename) {
56
+ return filename;
57
+ },
58
+ getCurrentDirectory() {
59
+ return '';
60
+ },
61
+ getNewLine() {
62
+ return '\n';
63
+ },
64
+ });
65
+ const emitResult = program.emit();
66
+ const allDiagnostics = emitResult.diagnostics;
67
+ allDiagnostics.forEach(diagnostic => {
68
+ if (diagnostic.file) {
69
+ const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
70
+ const message = flattenDiagnosticMessageText(diagnostic.messageText, '\n');
71
+ errors.push(`${line + 1},${character + 1}: ${message} ->
72
+ ${contents.split('\n')[line]}`);
73
+ }
74
+ else {
75
+ errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
76
+ }
77
+ });
78
+ }
79
+ else {
45
80
  const result = createSourceFile(testFile, contents, ScriptTarget.ES2016, false, isTsx ? ScriptKind.TSX : undefined);
46
81
  const allDiagnostics = result.parseDiagnostics;
47
82
  if (allDiagnostics && allDiagnostics.length > 0) {
48
- const errors = [];
49
83
  allDiagnostics.forEach(diagnostic => {
50
84
  if (diagnostic.file) {
51
85
  const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
52
86
  const message = flattenDiagnosticMessageText(diagnostic.messageText, '\n');
53
87
  errors.push(`${line + 1},${character + 1}: ${message} ->
54
- ${contents.split('\n')[line]}`);
88
+ ${contents.split('\n')[line]}`);
55
89
  }
56
90
  else {
57
91
  errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
58
92
  }
59
- const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
60
- if (relevantErrors && relevantErrors.length > 0) {
61
- throw new Error(relevantErrors.join('\n'));
62
- }
63
93
  });
64
94
  }
65
95
  }
66
- catch (e) {
67
- if (openPlayground && !process.env) {
68
- const compressedCode = compressToEncodedURIComponent(contents);
69
- open('http://www.typescriptlang.org/play/#code/' + compressedCode);
96
+ const relevantErrors = errors.filter(e => {
97
+ if (e.includes('Cannot find module')) {
98
+ return false;
70
99
  }
71
- throw e;
100
+ for (const suspenseError of suspenseErrors) {
101
+ if (e.includes(suspenseError)) {
102
+ return false;
103
+ }
104
+ }
105
+ return true;
106
+ });
107
+ if (relevantErrors && relevantErrors.length > 0) {
108
+ throw new Error(relevantErrors.join('\n'));
72
109
  }
73
110
  }
74
- function compileTs(contents, options = {
111
+ export function compileTs(contents, options = {
75
112
  noEmitOnError: true,
76
113
  noImplicitAny: true,
77
114
  moduleResolution: ModuleResolutionKind.NodeJs,
@@ -106,17 +143,17 @@ function compileTs(contents, options = {
106
143
  }
107
144
  return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
108
145
  },
109
- writeFile: function () { },
110
- useCaseSensitiveFileNames: function () {
146
+ writeFile() { },
147
+ useCaseSensitiveFileNames() {
111
148
  return false;
112
149
  },
113
- getCanonicalFileName: function (filename) {
150
+ getCanonicalFileName(filename) {
114
151
  return filename;
115
152
  },
116
- getCurrentDirectory: function () {
153
+ getCurrentDirectory() {
117
154
  return '';
118
155
  },
119
- getNewLine: function () {
156
+ getNewLine() {
120
157
  return '\n';
121
158
  },
122
159
  });
@@ -147,72 +184,3 @@ function compileTs(contents, options = {
147
184
  throw e;
148
185
  }
149
186
  }
150
-
151
- function compareStrings(a, b) {
152
- return a.includes(b);
153
- }
154
- expect.extend({
155
- toBeSimilarStringTo(received, expected) {
156
- const strippedReceived = oneLine `${received}`.replace(/\s\s+/g, ' ');
157
- const strippedExpected = oneLine `${expected}`.replace(/\s\s+/g, ' ');
158
- if (compareStrings(strippedReceived, strippedExpected)) {
159
- return {
160
- message: () => `expected
161
- ${received}
162
- not to be a string containing (ignoring indents)
163
- ${expected}`,
164
- pass: true,
165
- };
166
- }
167
- else {
168
- const diffString = diff(stripIndent `${expected}`, stripIndent `${received}`, {
169
- expand: this.expand,
170
- });
171
- const hasExpect = diffString && diffString.includes('- Expect');
172
- const message = hasExpect
173
- ? `Difference:\n\n${diffString}`
174
- : `expected
175
- ${received}
176
- to be a string containing (ignoring indents)
177
- ${expected}`;
178
- return {
179
- message: () => message,
180
- pass: false,
181
- };
182
- }
183
- },
184
- });
185
- function findProjectDir(dirname) {
186
- const originalDirname = dirname;
187
- const cwd = process.cwd();
188
- const stopDir = resolve(cwd, '..');
189
- while (dirname !== stopDir) {
190
- try {
191
- if (existsSync(resolve(dirname, 'package.json'))) {
192
- return dirname;
193
- }
194
- dirname = resolve(dirname, '..');
195
- }
196
- catch (e) {
197
- // ignore
198
- }
199
- }
200
- throw new Error(`Coudn't find project's root from: ${originalDirname}`);
201
- }
202
- function useMonorepo({ dirname }) {
203
- const cwd = findProjectDir(dirname);
204
- return {
205
- correctCWD() {
206
- let spyProcessCwd;
207
- beforeEach(() => {
208
- spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);
209
- });
210
- afterEach(() => {
211
- spyProcessCwd.mockRestore();
212
- });
213
- },
214
- };
215
- }
216
-
217
- export { compileTs, useMonorepo, validateTs };
218
- //# sourceMappingURL=index.esm.js.map
package/package.json CHANGED
@@ -1,30 +1,45 @@
1
1
  {
2
2
  "name": "@graphql-codegen/testing",
3
- "version": "1.17.8-alpha-dd1d7ffc.0",
3
+ "version": "1.18.0-alpha-20221101142840-b5a6a91f6",
4
4
  "description": "GraphQL Codegen Testing Utils",
5
5
  "peerDependencies": {
6
- "jest-diff": "^23.0.0 || ^24.0.0 || ^25.0.0 || ^26.0.0",
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": "1.17.8-alpha-dd1d7ffc.0",
10
+ "@graphql-codegen/plugin-helpers": "^2.7.2",
11
11
  "common-tags": "^1.8.0",
12
12
  "lz-string": "^1.4.4",
13
- "open": "^7.1.0",
14
- "tslib": "~2.0.0"
13
+ "graphql-helix": "1.13.0",
14
+ "nock": "13.2.9",
15
+ "tslib": "~2.4.0"
15
16
  },
16
17
  "repository": "git@github.com:dotansimha/graphql-code-generator.git",
17
18
  "homepage": "https://github.com/dotansimha/graphql-code-generator#readme",
18
19
  "author": "Dotan Simha <dotansimha@gmail.com>",
19
20
  "license": "MIT",
20
- "main": "index.cjs.js",
21
- "module": "index.esm.js",
22
- "typings": "index.d.ts",
21
+ "main": "cjs/index.js",
22
+ "module": "esm/index.js",
23
+ "typings": "typings/index.d.ts",
23
24
  "typescript": {
24
- "definition": "index.d.ts"
25
+ "definition": "typings/index.d.ts"
25
26
  },
26
- "publishConfig": {
27
- "access": "public",
28
- "tag": "alpha"
27
+ "type": "module",
28
+ "exports": {
29
+ ".": {
30
+ "require": {
31
+ "types": "./typings/index.d.cts",
32
+ "default": "./cjs/index.js"
33
+ },
34
+ "import": {
35
+ "types": "./typings/index.d.ts",
36
+ "default": "./esm/index.js"
37
+ },
38
+ "default": {
39
+ "types": "./typings/index.d.ts",
40
+ "default": "./esm/index.js"
41
+ }
42
+ },
43
+ "./package.json": "./package.json"
29
44
  }
30
- }
45
+ }
@@ -0,0 +1,18 @@
1
+ declare global {
2
+ namespace jest {
3
+ interface Matchers<R, T> {
4
+ /**
5
+ * Normalizes whitespace and performs string comparisons
6
+ */
7
+ toBeSimilarStringTo(expected: string): R;
8
+ }
9
+ }
10
+ }
11
+ export declare function useMonorepo({ dirname }: {
12
+ dirname: string;
13
+ }): {
14
+ correctCWD(): void;
15
+ };
16
+ export * from './typescript.cjs';
17
+ export * from './mock-graphql-server.cjs';
18
+ export * from './resolvers-common.cjs';
@@ -13,4 +13,6 @@ export declare function useMonorepo({ dirname }: {
13
13
  }): {
14
14
  correctCWD(): void;
15
15
  };
16
- export * from './typescript';
16
+ export * from './typescript.js';
17
+ export * from './mock-graphql-server.js';
18
+ export * from './resolvers-common.js';
@@ -0,0 +1,9 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import nock from 'nock';
3
+ export declare function mockGraphQLServer({ schema, host, path, intercept, method, }: {
4
+ schema: GraphQLSchema;
5
+ host: string;
6
+ path: string | RegExp | ((path: string) => boolean);
7
+ intercept?: (obj: nock.ReplyFnContext) => void;
8
+ method?: string;
9
+ }): nock.Scope;
@@ -0,0 +1,9 @@
1
+ import { GraphQLSchema } from 'graphql';
2
+ import nock from 'nock';
3
+ export declare function mockGraphQLServer({ schema, host, path, intercept, method, }: {
4
+ schema: GraphQLSchema;
5
+ host: string;
6
+ path: string | RegExp | ((path: string) => boolean);
7
+ intercept?: (obj: nock.ReplyFnContext) => void;
8
+ method?: string;
9
+ }): nock.Scope;
@@ -0,0 +1,3 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare const resolversTestingSchema: import("graphql").GraphQLSchema;
3
+ export declare const resolversTestingValidate: (content: Types.PluginOutput, config?: any, pluginSchema?: import("graphql").GraphQLSchema, additionalCode?: string) => Promise<string>;
@@ -0,0 +1,3 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ export declare const resolversTestingSchema: import("graphql").GraphQLSchema;
3
+ export declare const resolversTestingValidate: (content: Types.PluginOutput, config?: any, pluginSchema?: import("graphql").GraphQLSchema, additionalCode?: string) => Promise<string>;
@@ -0,0 +1,4 @@
1
+ import { Types } from '@graphql-codegen/plugin-helpers';
2
+ import { CompilerOptions } from 'typescript';
3
+ export declare function validateTs(pluginOutput: Types.PluginOutput, options?: CompilerOptions, isTsx?: boolean, isStrict?: boolean, suspenseErrors?: string[], compileProgram?: boolean): void;
4
+ export declare function compileTs(contents: string, options?: CompilerOptions, isTsx?: boolean, openPlayground?: boolean): void;
@@ -1,4 +1,4 @@
1
1
  import { Types } from '@graphql-codegen/plugin-helpers';
2
2
  import { CompilerOptions } from 'typescript';
3
- export declare function validateTs(pluginOutput: Types.PluginOutput, options?: CompilerOptions, isTsx?: boolean, isStrict?: boolean, openPlayground?: boolean): void;
3
+ export declare function validateTs(pluginOutput: Types.PluginOutput, options?: CompilerOptions, isTsx?: boolean, isStrict?: boolean, suspenseErrors?: string[], compileProgram?: boolean): void;
4
4
  export declare function compileTs(contents: string, options?: CompilerOptions, isTsx?: boolean, openPlayground?: boolean): void;
package/index.cjs.js DELETED
@@ -1,226 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- const commonTags = require('common-tags');
8
- const path = require('path');
9
- const fs = require('fs');
10
- const diff = _interopDefault(require('jest-diff'));
11
- const typescript = require('typescript');
12
- const open = _interopDefault(require('open'));
13
-
14
- const { compressToEncodedURIComponent } = require('lz-string');
15
- function validateTs(pluginOutput, options = {
16
- noEmitOnError: true,
17
- noImplicitAny: true,
18
- moduleResolution: typescript.ModuleResolutionKind.NodeJs,
19
- experimentalDecorators: true,
20
- emitDecoratorMetadata: true,
21
- target: typescript.ScriptTarget.ES5,
22
- typeRoots: [path.resolve(require.resolve('typescript'), '../../../@types/')],
23
- jsx: typescript.JsxEmit.Preserve,
24
- allowJs: true,
25
- lib: [
26
- path.join(path.dirname(require.resolve('typescript')), 'lib.es5.d.ts'),
27
- path.join(path.dirname(require.resolve('typescript')), 'lib.es6.d.ts'),
28
- path.join(path.dirname(require.resolve('typescript')), 'lib.dom.d.ts'),
29
- path.join(path.dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),
30
- path.join(path.dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),
31
- path.join(path.dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),
32
- ],
33
- module: typescript.ModuleKind.ESNext,
34
- }, isTsx = false, isStrict = false, openPlayground = false) {
35
- if (process.env.SKIP_VALIDATION) {
36
- return;
37
- }
38
- if (isStrict) {
39
- options.strictNullChecks = true;
40
- options.strict = true;
41
- options.strictBindCallApply = true;
42
- options.strictPropertyInitialization = true;
43
- options.alwaysStrict = true;
44
- options.strictFunctionTypes = true;
45
- }
46
- const contents = typeof pluginOutput === 'string'
47
- ? pluginOutput
48
- : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\n');
49
- try {
50
- const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
51
- const result = typescript.createSourceFile(testFile, contents, typescript.ScriptTarget.ES2016, false, isTsx ? typescript.ScriptKind.TSX : undefined);
52
- const allDiagnostics = result.parseDiagnostics;
53
- if (allDiagnostics && allDiagnostics.length > 0) {
54
- const errors = [];
55
- allDiagnostics.forEach(diagnostic => {
56
- if (diagnostic.file) {
57
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
58
- const message = typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
59
- errors.push(`${line + 1},${character + 1}: ${message} ->
60
- ${contents.split('\n')[line]}`);
61
- }
62
- else {
63
- errors.push(`${typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
64
- }
65
- const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
66
- if (relevantErrors && relevantErrors.length > 0) {
67
- throw new Error(relevantErrors.join('\n'));
68
- }
69
- });
70
- }
71
- }
72
- catch (e) {
73
- if (openPlayground && !process.env) {
74
- const compressedCode = compressToEncodedURIComponent(contents);
75
- open('http://www.typescriptlang.org/play/#code/' + compressedCode);
76
- }
77
- throw e;
78
- }
79
- }
80
- function compileTs(contents, options = {
81
- noEmitOnError: true,
82
- noImplicitAny: true,
83
- moduleResolution: typescript.ModuleResolutionKind.NodeJs,
84
- allowSyntheticDefaultImports: true,
85
- experimentalDecorators: true,
86
- emitDecoratorMetadata: true,
87
- target: typescript.ScriptTarget.ES5,
88
- typeRoots: [path.resolve(require.resolve('typescript'), '../../../@types/')],
89
- jsx: typescript.JsxEmit.Preserve,
90
- allowJs: true,
91
- lib: [
92
- path.join(path.dirname(require.resolve('typescript')), 'lib.es5.d.ts'),
93
- path.join(path.dirname(require.resolve('typescript')), 'lib.es6.d.ts'),
94
- path.join(path.dirname(require.resolve('typescript')), 'lib.dom.d.ts'),
95
- path.join(path.dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),
96
- path.join(path.dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),
97
- path.join(path.dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),
98
- ],
99
- module: typescript.ModuleKind.ESNext,
100
- }, isTsx = false, openPlayground = false) {
101
- if (process.env.SKIP_VALIDATION) {
102
- return;
103
- }
104
- try {
105
- const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
106
- const host = typescript.createCompilerHost(options);
107
- const program = typescript.createProgram([testFile], options, {
108
- ...host,
109
- getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
110
- if (fileName === testFile) {
111
- return typescript.createSourceFile(fileName, contents, options.target);
112
- }
113
- return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
114
- },
115
- writeFile: function () { },
116
- useCaseSensitiveFileNames: function () {
117
- return false;
118
- },
119
- getCanonicalFileName: function (filename) {
120
- return filename;
121
- },
122
- getCurrentDirectory: function () {
123
- return '';
124
- },
125
- getNewLine: function () {
126
- return '\n';
127
- },
128
- });
129
- const emitResult = program.emit();
130
- const allDiagnostics = emitResult.diagnostics;
131
- const errors = [];
132
- allDiagnostics.forEach(diagnostic => {
133
- if (diagnostic.file) {
134
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
135
- const message = typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
136
- errors.push(`${line + 1},${character + 1}: ${message} ->
137
- ${contents.split('\n')[line]}`);
138
- }
139
- else {
140
- errors.push(`${typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`);
141
- }
142
- });
143
- const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));
144
- if (relevantErrors && relevantErrors.length > 0) {
145
- throw new Error(relevantErrors.join('\n'));
146
- }
147
- }
148
- catch (e) {
149
- if (openPlayground) {
150
- const compressedCode = compressToEncodedURIComponent(contents);
151
- open('http://www.typescriptlang.org/play/#code/' + compressedCode);
152
- }
153
- throw e;
154
- }
155
- }
156
-
157
- function compareStrings(a, b) {
158
- return a.includes(b);
159
- }
160
- expect.extend({
161
- toBeSimilarStringTo(received, expected) {
162
- const strippedReceived = commonTags.oneLine `${received}`.replace(/\s\s+/g, ' ');
163
- const strippedExpected = commonTags.oneLine `${expected}`.replace(/\s\s+/g, ' ');
164
- if (compareStrings(strippedReceived, strippedExpected)) {
165
- return {
166
- message: () => `expected
167
- ${received}
168
- not to be a string containing (ignoring indents)
169
- ${expected}`,
170
- pass: true,
171
- };
172
- }
173
- else {
174
- const diffString = diff(commonTags.stripIndent `${expected}`, commonTags.stripIndent `${received}`, {
175
- expand: this.expand,
176
- });
177
- const hasExpect = diffString && diffString.includes('- Expect');
178
- const message = hasExpect
179
- ? `Difference:\n\n${diffString}`
180
- : `expected
181
- ${received}
182
- to be a string containing (ignoring indents)
183
- ${expected}`;
184
- return {
185
- message: () => message,
186
- pass: false,
187
- };
188
- }
189
- },
190
- });
191
- function findProjectDir(dirname) {
192
- const originalDirname = dirname;
193
- const cwd = process.cwd();
194
- const stopDir = path.resolve(cwd, '..');
195
- while (dirname !== stopDir) {
196
- try {
197
- if (fs.existsSync(path.resolve(dirname, 'package.json'))) {
198
- return dirname;
199
- }
200
- dirname = path.resolve(dirname, '..');
201
- }
202
- catch (e) {
203
- // ignore
204
- }
205
- }
206
- throw new Error(`Coudn't find project's root from: ${originalDirname}`);
207
- }
208
- function useMonorepo({ dirname }) {
209
- const cwd = findProjectDir(dirname);
210
- return {
211
- correctCWD() {
212
- let spyProcessCwd;
213
- beforeEach(() => {
214
- spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);
215
- });
216
- afterEach(() => {
217
- spyProcessCwd.mockRestore();
218
- });
219
- },
220
- };
221
- }
222
-
223
- exports.compileTs = compileTs;
224
- exports.useMonorepo = useMonorepo;
225
- exports.validateTs = validateTs;
226
- //# sourceMappingURL=index.cjs.js.map
package/index.cjs.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../../dist/utils/graphql-codegen-testing/src/typescript.js","../../../dist/utils/graphql-codegen-testing/src/index.js"],"sourcesContent":["import { ModuleResolutionKind, ScriptTarget, JsxEmit, ModuleKind, createSourceFile, ScriptKind, flattenDiagnosticMessageText, createCompilerHost, createProgram, } from 'typescript';\nimport { resolve, join, dirname } from 'path';\nimport open from 'open';\nconst { compressToEncodedURIComponent } = require('lz-string');\nexport function validateTs(pluginOutput, options = {\n noEmitOnError: true,\n noImplicitAny: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n target: ScriptTarget.ES5,\n typeRoots: [resolve(require.resolve('typescript'), '../../../@types/')],\n jsx: JsxEmit.Preserve,\n allowJs: true,\n lib: [\n join(dirname(require.resolve('typescript')), 'lib.es5.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es6.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.dom.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),\n ],\n module: ModuleKind.ESNext,\n}, isTsx = false, isStrict = false, openPlayground = false) {\n if (process.env.SKIP_VALIDATION) {\n return;\n }\n if (isStrict) {\n options.strictNullChecks = true;\n options.strict = true;\n options.strictBindCallApply = true;\n options.strictPropertyInitialization = true;\n options.alwaysStrict = true;\n options.strictFunctionTypes = true;\n }\n const contents = typeof pluginOutput === 'string'\n ? pluginOutput\n : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\\n');\n try {\n const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;\n const result = createSourceFile(testFile, contents, ScriptTarget.ES2016, false, isTsx ? ScriptKind.TSX : undefined);\n const allDiagnostics = result.parseDiagnostics;\n if (allDiagnostics && allDiagnostics.length > 0) {\n const errors = [];\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errors.push(`${line + 1},${character + 1}: ${message} ->\n ${contents.split('\\n')[line]}`);\n }\n else {\n errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\\n')}`);\n }\n const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));\n if (relevantErrors && relevantErrors.length > 0) {\n throw new Error(relevantErrors.join('\\n'));\n }\n });\n }\n }\n catch (e) {\n if (openPlayground && !process.env) {\n const compressedCode = compressToEncodedURIComponent(contents);\n open('http://www.typescriptlang.org/play/#code/' + compressedCode);\n }\n throw e;\n }\n}\nexport function compileTs(contents, options = {\n noEmitOnError: true,\n noImplicitAny: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n allowSyntheticDefaultImports: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n target: ScriptTarget.ES5,\n typeRoots: [resolve(require.resolve('typescript'), '../../../@types/')],\n jsx: JsxEmit.Preserve,\n allowJs: true,\n lib: [\n join(dirname(require.resolve('typescript')), 'lib.es5.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es6.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.dom.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),\n ],\n module: ModuleKind.ESNext,\n}, isTsx = false, openPlayground = false) {\n if (process.env.SKIP_VALIDATION) {\n return;\n }\n try {\n const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;\n const host = createCompilerHost(options);\n const program = createProgram([testFile], options, {\n ...host,\n getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {\n if (fileName === testFile) {\n return createSourceFile(fileName, contents, options.target);\n }\n return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);\n },\n writeFile: function () { },\n useCaseSensitiveFileNames: function () {\n return false;\n },\n getCanonicalFileName: function (filename) {\n return filename;\n },\n getCurrentDirectory: function () {\n return '';\n },\n getNewLine: function () {\n return '\\n';\n },\n });\n const emitResult = program.emit();\n const allDiagnostics = emitResult.diagnostics;\n const errors = [];\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errors.push(`${line + 1},${character + 1}: ${message} ->\n ${contents.split('\\n')[line]}`);\n }\n else {\n errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\\n')}`);\n }\n });\n const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));\n if (relevantErrors && relevantErrors.length > 0) {\n throw new Error(relevantErrors.join('\\n'));\n }\n }\n catch (e) {\n if (openPlayground) {\n const compressedCode = compressToEncodedURIComponent(contents);\n open('http://www.typescriptlang.org/play/#code/' + compressedCode);\n }\n throw e;\n }\n}\n//# sourceMappingURL=typescript.js.map","import { oneLine, stripIndent } from 'common-tags';\nimport { resolve } from 'path';\nimport { existsSync } from 'fs';\nimport diff from 'jest-diff';\nfunction compareStrings(a, b) {\n return a.includes(b);\n}\nexpect.extend({\n toBeSimilarStringTo(received, expected) {\n const strippedReceived = oneLine `${received}`.replace(/\\s\\s+/g, ' ');\n const strippedExpected = oneLine `${expected}`.replace(/\\s\\s+/g, ' ');\n if (compareStrings(strippedReceived, strippedExpected)) {\n return {\n message: () => `expected \n ${received}\n not to be a string containing (ignoring indents)\n ${expected}`,\n pass: true,\n };\n }\n else {\n const diffString = diff(stripIndent `${expected}`, stripIndent `${received}`, {\n expand: this.expand,\n });\n const hasExpect = diffString && diffString.includes('- Expect');\n const message = hasExpect\n ? `Difference:\\n\\n${diffString}`\n : `expected \n ${received}\n to be a string containing (ignoring indents)\n ${expected}`;\n return {\n message: () => message,\n pass: false,\n };\n }\n },\n});\nfunction findProjectDir(dirname) {\n const originalDirname = dirname;\n const cwd = process.cwd();\n const stopDir = resolve(cwd, '..');\n while (dirname !== stopDir) {\n try {\n if (existsSync(resolve(dirname, 'package.json'))) {\n return dirname;\n }\n dirname = resolve(dirname, '..');\n }\n catch (e) {\n // ignore\n }\n }\n throw new Error(`Coudn't find project's root from: ${originalDirname}`);\n}\nexport function useMonorepo({ dirname }) {\n const cwd = findProjectDir(dirname);\n return {\n correctCWD() {\n let spyProcessCwd;\n beforeEach(() => {\n spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);\n });\n afterEach(() => {\n spyProcessCwd.mockRestore();\n });\n },\n };\n}\nexport * from './typescript';\n//# sourceMappingURL=index.js.map"],"names":["ModuleResolutionKind","ScriptTarget","resolve","JsxEmit","join","dirname","ModuleKind","createSourceFile","ScriptKind","flattenDiagnosticMessageText","createCompilerHost","createProgram","oneLine","stripIndent","existsSync"],"mappings":";;;;;;;;;;;;;AAGA,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACxD,SAAS,UAAU,CAAC,YAAY,EAAE,OAAO,GAAG;AACnD,IAAI,aAAa,EAAE,IAAI;AACvB,IAAI,aAAa,EAAE,IAAI;AACvB,IAAI,gBAAgB,EAAEA,+BAAoB,CAAC,MAAM;AACjD,IAAI,sBAAsB,EAAE,IAAI;AAChC,IAAI,qBAAqB,EAAE,IAAI;AAC/B,IAAI,MAAM,EAAEC,uBAAY,CAAC,GAAG;AAC5B,IAAI,SAAS,EAAE,CAACC,YAAO,CAA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CAAC,GAAG,EAAE,CAAC;AAC9B,IAAI,MAAM,OAAO,GAAGX,YAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACvC,IAAI,OAAO,OAAO,KAAK,OAAO,EAAE;AAChC,QAAQ,IAAI;AACZ,YAAY,IAAIY,aAAU,CAACZ,YAAO,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE;AAC9D,gBAAgB,OAAO,OAAO,CAAC;AAC/B,aAAa;AACb,YAAY,OAAO,GAAGA,YAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC7C,SAAS;AACT,QAAQ,OAAO,CAAC,EAAE;AAClB;AACA,SAAS;AACT,KAAK;AACL,IAAI,MAAM,IAAI,KAAK,CAAC,CAAC,kCAAkC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;AAC5E,CAAC;AACM,SAAS,WAAW,CAAC,EAAE,OAAO,EAAE,EAAE;AACzC,IAAI,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;AACxC,IAAI,OAAO;AACX,QAAQ,UAAU,GAAG;AACrB,YAAY,IAAI,aAAa,CAAC;AAC9B,YAAY,UAAU,CAAC,MAAM;AAC7B,gBAAgB,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAChF,aAAa,CAAC,CAAC;AACf,YAAY,SAAS,CAAC,MAAM;AAC5B,gBAAgB,aAAa,CAAC,WAAW,EAAE,CAAC;AAC5C,aAAa,CAAC,CAAC;AACf,SAAS;AACT,KAAK,CAAC;AACN;;;;;;"}
package/index.esm.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../dist/utils/graphql-codegen-testing/src/typescript.js","../../../dist/utils/graphql-codegen-testing/src/index.js"],"sourcesContent":["import { ModuleResolutionKind, ScriptTarget, JsxEmit, ModuleKind, createSourceFile, ScriptKind, flattenDiagnosticMessageText, createCompilerHost, createProgram, } from 'typescript';\nimport { resolve, join, dirname } from 'path';\nimport open from 'open';\nconst { compressToEncodedURIComponent } = require('lz-string');\nexport function validateTs(pluginOutput, options = {\n noEmitOnError: true,\n noImplicitAny: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n target: ScriptTarget.ES5,\n typeRoots: [resolve(require.resolve('typescript'), '../../../@types/')],\n jsx: JsxEmit.Preserve,\n allowJs: true,\n lib: [\n join(dirname(require.resolve('typescript')), 'lib.es5.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es6.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.dom.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),\n ],\n module: ModuleKind.ESNext,\n}, isTsx = false, isStrict = false, openPlayground = false) {\n if (process.env.SKIP_VALIDATION) {\n return;\n }\n if (isStrict) {\n options.strictNullChecks = true;\n options.strict = true;\n options.strictBindCallApply = true;\n options.strictPropertyInitialization = true;\n options.alwaysStrict = true;\n options.strictFunctionTypes = true;\n }\n const contents = typeof pluginOutput === 'string'\n ? pluginOutput\n : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\\n');\n try {\n const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;\n const result = createSourceFile(testFile, contents, ScriptTarget.ES2016, false, isTsx ? ScriptKind.TSX : undefined);\n const allDiagnostics = result.parseDiagnostics;\n if (allDiagnostics && allDiagnostics.length > 0) {\n const errors = [];\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errors.push(`${line + 1},${character + 1}: ${message} ->\n ${contents.split('\\n')[line]}`);\n }\n else {\n errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\\n')}`);\n }\n const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));\n if (relevantErrors && relevantErrors.length > 0) {\n throw new Error(relevantErrors.join('\\n'));\n }\n });\n }\n }\n catch (e) {\n if (openPlayground && !process.env) {\n const compressedCode = compressToEncodedURIComponent(contents);\n open('http://www.typescriptlang.org/play/#code/' + compressedCode);\n }\n throw e;\n }\n}\nexport function compileTs(contents, options = {\n noEmitOnError: true,\n noImplicitAny: true,\n moduleResolution: ModuleResolutionKind.NodeJs,\n allowSyntheticDefaultImports: true,\n experimentalDecorators: true,\n emitDecoratorMetadata: true,\n target: ScriptTarget.ES5,\n typeRoots: [resolve(require.resolve('typescript'), '../../../@types/')],\n jsx: JsxEmit.Preserve,\n allowJs: true,\n lib: [\n join(dirname(require.resolve('typescript')), 'lib.es5.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es6.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.dom.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.scripthost.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.es2015.d.ts'),\n join(dirname(require.resolve('typescript')), 'lib.esnext.asynciterable.d.ts'),\n ],\n module: ModuleKind.ESNext,\n}, isTsx = false, openPlayground = false) {\n if (process.env.SKIP_VALIDATION) {\n return;\n }\n try {\n const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;\n const host = createCompilerHost(options);\n const program = createProgram([testFile], options, {\n ...host,\n getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {\n if (fileName === testFile) {\n return createSourceFile(fileName, contents, options.target);\n }\n return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);\n },\n writeFile: function () { },\n useCaseSensitiveFileNames: function () {\n return false;\n },\n getCanonicalFileName: function (filename) {\n return filename;\n },\n getCurrentDirectory: function () {\n return '';\n },\n getNewLine: function () {\n return '\\n';\n },\n });\n const emitResult = program.emit();\n const allDiagnostics = emitResult.diagnostics;\n const errors = [];\n allDiagnostics.forEach(diagnostic => {\n if (diagnostic.file) {\n const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n const message = flattenDiagnosticMessageText(diagnostic.messageText, '\\n');\n errors.push(`${line + 1},${character + 1}: ${message} ->\n ${contents.split('\\n')[line]}`);\n }\n else {\n errors.push(`${flattenDiagnosticMessageText(diagnostic.messageText, '\\n')}`);\n }\n });\n const relevantErrors = errors.filter(e => !e.includes('Cannot find module'));\n if (relevantErrors && relevantErrors.length > 0) {\n throw new Error(relevantErrors.join('\\n'));\n }\n }\n catch (e) {\n if (openPlayground) {\n const compressedCode = compressToEncodedURIComponent(contents);\n open('http://www.typescriptlang.org/play/#code/' + compressedCode);\n }\n throw e;\n }\n}\n//# sourceMappingURL=typescript.js.map","import { oneLine, stripIndent } from 'common-tags';\nimport { resolve } from 'path';\nimport { existsSync } from 'fs';\nimport diff from 'jest-diff';\nfunction compareStrings(a, b) {\n return a.includes(b);\n}\nexpect.extend({\n toBeSimilarStringTo(received, expected) {\n const strippedReceived = oneLine `${received}`.replace(/\\s\\s+/g, ' ');\n const strippedExpected = oneLine `${expected}`.replace(/\\s\\s+/g, ' ');\n if (compareStrings(strippedReceived, strippedExpected)) {\n return {\n message: () => `expected \n ${received}\n not to be a string containing (ignoring indents)\n ${expected}`,\n pass: true,\n };\n }\n else {\n const diffString = diff(stripIndent `${expected}`, stripIndent `${received}`, {\n expand: this.expand,\n });\n const hasExpect = diffString && diffString.includes('- Expect');\n const message = hasExpect\n ? `Difference:\\n\\n${diffString}`\n : `expected \n ${received}\n to be a string containing (ignoring indents)\n ${expected}`;\n return {\n message: () => message,\n pass: false,\n };\n }\n },\n});\nfunction findProjectDir(dirname) {\n const originalDirname = dirname;\n const cwd = process.cwd();\n const stopDir = resolve(cwd, '..');\n while (dirname !== stopDir) {\n try {\n if (existsSync(resolve(dirname, 'package.json'))) {\n return dirname;\n }\n dirname = resolve(dirname, '..');\n }\n catch (e) {\n // ignore\n }\n }\n throw new Error(`Coudn't find project's root from: ${originalDirname}`);\n}\nexport function useMonorepo({ dirname }) {\n const cwd = findProjectDir(dirname);\n return {\n correctCWD() {\n let spyProcessCwd;\n beforeEach(() => {\n spyProcessCwd = jest.spyOn(process, 'cwd').mockReturnValue(cwd);\n });\n afterEach(() => {\n spyProcessCwd.mockRestore();\n });\n },\n };\n}\nexport * from './typescript';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;;;AAGA,MAAM,EAAE,6BAA6B,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AACxD,SAAS,UAAU,CAAC,YAAY,EAAE,OAAO,GAAG;AACnD,IAAI,aAAa,EAAE,IAAI;AACvB,IAAI,aAAa,EAAE,IAAI;AACvB,IAAI,gBAAgB,EAAE,oBAAoB,CAAC,MAAM;AACjD,IAAI,sBAAsB,EAAE,IAAI;AAChC,IAAI,qBAAqB,EAAE,IAAI;AAC/B,IAAI,MAAM,EAAE,YAAY,CAAC,GAAG;AAC5B,IAAI,SAAS,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC3E,IAAI,GAAG,EAAE,OAAO,CAAC,QAAQ;AACzB,IAAI,OAAO,EAAE,IAAI;AACjB,IAAI,GAAG,EAAE;AACT,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc,CAAC;AACpE,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc,CAAC;AACpE,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,cAAc,CAAC;AACpE,QAAQ,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAAE,qBAAqB,CA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