Skip to content

Commit

Permalink
fix: add CTA to warning message
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Oct 13, 2023
1 parent a02a48b commit b77b9ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion packages/amplify-codegen/src/commands/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ async function generateTypes(context, forceDownloadSchema, withoutInit = false,
})
.filter(([queryFilePath, source]) => {
if (!source) {
context.print.warning(`Unable to extract GraphQL queries from ${queryFilePath}. Skipping source.`);
context.print.warning(
`Unable to extract GraphQL queries from ${queryFilePath}. Skipping source. This source matched the includes target in .grapqhlconfig.yml. Modify the includes or excludes target if this file should not be included.`,
);
return false;
}
return true;
Expand Down
8 changes: 6 additions & 2 deletions packages/amplify-codegen/tests/commands/types-mock-fs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,14 @@ describe('command - types (mock fs)', () => {
await generateStatements(MOCK_CONTEXT, false);
await generateTypes(MOCK_CONTEXT, false);
expect(MOCK_CONTEXT.print.warning).toHaveBeenCalledWith(
expect.stringMatching('Unable to extract GraphQL queries from .*/src/graphql/foo.ts. Skipping source.'),
expect.stringMatching(
'Unable to extract GraphQL queries from .*/src/graphql/foo.ts. Skipping source. This source matched the includes target in .grapqhlconfig.yml. Modify the includes or excludes target if this file should not be included.',
),
);
expect(MOCK_CONTEXT.print.warning).not.toHaveBeenCalledWith(
expect.stringMatching('Unable to extract GraphQL queries from .*/src/graphql/excluded.ts. Skipping source.'),
expect.stringMatching(
'Unable to extract GraphQL queries from .*/src/graphql/excluded.ts. Skipping source. This source matched the includes target in .grapqhlconfig.yml. Modify the includes or excludes target if this file should not be included.',
),
);
expect(fs.existsSync(generatedFileName)).toBeTruthy();
});
Expand Down

0 comments on commit b77b9ad

Please sign in to comment.