@graphql-codegen/testing 3.0.3 → 3.0.4-alpha-20240724113208-0b8b193f95803edd7f860ff4987c634bc702db5b

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/typescript.js CHANGED
@@ -38,7 +38,7 @@ function validateTs(pluginOutput, options = {
38
38
  }
39
39
  const contents = typeof pluginOutput === 'string'
40
40
  ? pluginOutput
41
- : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\n');
41
+ : [...new Set([...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])])].join('\n');
42
42
  const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
43
43
  const errors = [];
44
44
  if (compileProgram) {
@@ -108,7 +108,10 @@ function validateTs(pluginOutput, options = {
108
108
  return true;
109
109
  });
110
110
  if (relevantErrors && relevantErrors.length > 0) {
111
- throw new Error(relevantErrors.join('\n'));
111
+ if (relevantErrors.length === 1) {
112
+ throw new Error(relevantErrors[0]);
113
+ }
114
+ throw new AggregateError(relevantErrors, relevantErrors.join('\n'));
112
115
  }
113
116
  }
114
117
  exports.validateTs = validateTs;
package/esm/typescript.js CHANGED
@@ -35,7 +35,7 @@ export function validateTs(pluginOutput, options = {
35
35
  }
36
36
  const contents = typeof pluginOutput === 'string'
37
37
  ? pluginOutput
38
- : [...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])].join('\n');
38
+ : [...new Set([...(pluginOutput.prepend || []), pluginOutput.content, ...(pluginOutput.append || [])])].join('\n');
39
39
  const testFile = `test-file.${isTsx ? 'tsx' : 'ts'}`;
40
40
  const errors = [];
41
41
  if (compileProgram) {
@@ -105,7 +105,10 @@ export function validateTs(pluginOutput, options = {
105
105
  return true;
106
106
  });
107
107
  if (relevantErrors && relevantErrors.length > 0) {
108
- throw new Error(relevantErrors.join('\n'));
108
+ if (relevantErrors.length === 1) {
109
+ throw new Error(relevantErrors[0]);
110
+ }
111
+ throw new AggregateError(relevantErrors, relevantErrors.join('\n'));
109
112
  }
110
113
  }
111
114
  export function compileTs(contents, options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/testing",
3
- "version": "3.0.3",
3
+ "version": "3.0.4-alpha-20240724113208-0b8b193f95803edd7f860ff4987c634bc702db5b",
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 || ^29.0.0",
@@ -11,7 +11,7 @@
11
11
  "common-tags": "^1.8.0",
12
12
  "lz-string": "^1.4.4",
13
13
  "graphql-helix": "1.13.0",
14
- "nock": "13.5.3",
14
+ "nock": "13.5.4",
15
15
  "tslib": "~2.6.0"
16
16
  },
17
17
  "repository": "git@github.com:dotansimha/graphql-code-generator.git",