@graphql-codegen/testing 5.0.4 → 5.0.5-alpha-20260926133005-45dec125a32bfc5e421de1c65a2a8b41e56959e4

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
@@ -61,7 +61,7 @@ function validateTs(pluginOutput, options = {
61
61
  ...host,
62
62
  getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
63
63
  if (fileName === testFile) {
64
- return (0, typescript_1.createSourceFile)(fileName, contents, options.target);
64
+ return (0, typescript_1.createSourceFile)(fileName, contents, options.target ?? languageVersion);
65
65
  }
66
66
  return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
67
67
  },
@@ -82,7 +82,7 @@ function validateTs(pluginOutput, options = {
82
82
  const emitResult = program.emit();
83
83
  const allDiagnostics = emitResult.diagnostics;
84
84
  for (const diagnostic of allDiagnostics) {
85
- if (diagnostic.file) {
85
+ if (diagnostic.file && diagnostic.start !== undefined) {
86
86
  const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
87
87
  const message = (0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n');
88
88
  errors.push(`${line + 1},${character + 1}: ${message} ->
@@ -160,7 +160,7 @@ function compileTs(contents, options = {
160
160
  ...host,
161
161
  getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
162
162
  if (fileName === testFile) {
163
- return (0, typescript_1.createSourceFile)(fileName, contents, options.target);
163
+ return (0, typescript_1.createSourceFile)(fileName, contents, options.target ?? languageVersion);
164
164
  }
165
165
  return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
166
166
  },
@@ -182,7 +182,7 @@ function compileTs(contents, options = {
182
182
  const allDiagnostics = emitResult.diagnostics;
183
183
  const errors = [];
184
184
  for (const diagnostic of allDiagnostics) {
185
- if (diagnostic.file) {
185
+ if (diagnostic.file && diagnostic.start !== undefined) {
186
186
  const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
187
187
  const message = (0, typescript_1.flattenDiagnosticMessageText)(diagnostic.messageText, '\n');
188
188
  errors.push(`${line + 1},${character + 1}: ${message} ->
package/esm/typescript.js CHANGED
@@ -56,7 +56,7 @@ export function validateTs(pluginOutput, options = {
56
56
  ...host,
57
57
  getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
58
58
  if (fileName === testFile) {
59
- return createSourceFile(fileName, contents, options.target);
59
+ return createSourceFile(fileName, contents, options.target ?? languageVersion);
60
60
  }
61
61
  return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
62
62
  },
@@ -77,7 +77,7 @@ export function validateTs(pluginOutput, options = {
77
77
  const emitResult = program.emit();
78
78
  const allDiagnostics = emitResult.diagnostics;
79
79
  for (const diagnostic of allDiagnostics) {
80
- if (diagnostic.file) {
80
+ if (diagnostic.file && diagnostic.start !== undefined) {
81
81
  const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
82
82
  const message = flattenDiagnosticMessageText(diagnostic.messageText, '\n');
83
83
  errors.push(`${line + 1},${character + 1}: ${message} ->
@@ -155,7 +155,7 @@ export function compileTs(contents, options = {
155
155
  ...host,
156
156
  getSourceFile: (fileName, languageVersion, onError, shouldCreateNewSourceFile) => {
157
157
  if (fileName === testFile) {
158
- return createSourceFile(fileName, contents, options.target);
158
+ return createSourceFile(fileName, contents, options.target ?? languageVersion);
159
159
  }
160
160
  return host.getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile);
161
161
  },
@@ -177,7 +177,7 @@ export function compileTs(contents, options = {
177
177
  const allDiagnostics = emitResult.diagnostics;
178
178
  const errors = [];
179
179
  for (const diagnostic of allDiagnostics) {
180
- if (diagnostic.file) {
180
+ if (diagnostic.file && diagnostic.start !== undefined) {
181
181
  const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
182
182
  const message = flattenDiagnosticMessageText(diagnostic.messageText, '\n');
183
183
  errors.push(`${line + 1},${character + 1}: ${message} ->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/testing",
3
- "version": "5.0.4",
3
+ "version": "5.0.5-alpha-20260926133005-45dec125a32bfc5e421de1c65a2a8b41e56959e4",
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 || ^30.0.0",