@@ -10,6 +10,7 @@ import {
10
10
addCodegen ,
11
11
AmplifyFrontend ,
12
12
amplifyPush ,
13
+ apiGqlCompile ,
13
14
} from '@aws-amplify/amplify-codegen-e2e-core' ;
14
15
const { schemas } = require ( '@aws-amplify/graphql-schema-test-library' ) ;
15
16
import { existsSync , writeFileSync , readdirSync , rmSync } from 'fs' ;
@@ -46,6 +47,7 @@ describe('build app - JS', () => {
46
47
// @ts -ignore
47
48
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ schema . sdl } ` ;
48
49
updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
50
+ apiGqlCompile ( projectRoot ) ;
49
51
await generateModels ( projectRoot ) ;
50
52
await generateStatementsAndTypes ( projectRoot ) ;
51
53
await craBuild ( projectRoot , { ...config } ) ;
@@ -55,6 +57,7 @@ describe('build app - JS', () => {
55
57
it ( 'fails build with syntax error in models' , async ( ) => {
56
58
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ ( Object . values ( schemas ) [ 0 ] as any ) . sdl } ` ;
57
59
updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
60
+ apiGqlCompile ( projectRoot ) ;
58
61
await generateStatementsAndTypes ( projectRoot ) ;
59
62
await writeFileSync ( path . join ( projectRoot , 'src' , 'models' , 'index.d.ts' ) , 'foo\nbar' ) ;
60
63
await expect ( craBuild ( projectRoot , { ...config } ) ) . rejects . toThrowError ( ) ;
@@ -63,6 +66,7 @@ describe('build app - JS', () => {
63
66
it ( 'fails build with syntax error in statements' , async ( ) => {
64
67
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ ( Object . values ( schemas ) [ 0 ] as any ) . sdl } ` ;
65
68
updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
69
+ apiGqlCompile ( projectRoot ) ;
66
70
await generateModels ( projectRoot ) ;
67
71
await generateStatementsAndTypes ( projectRoot ) ;
68
72
await writeFileSync ( path . join ( projectRoot , 'src' , 'graphql' , 'queries.ts' ) , 'foo\nbar' ) ;
@@ -72,6 +76,7 @@ describe('build app - JS', () => {
72
76
it ( 'fails build with syntax error in types' , async ( ) => {
73
77
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${ ( Object . values ( schemas ) [ 0 ] as any ) . sdl } ` ;
74
78
updateApiSchemaWithText ( projectRoot , apiName , schemaText ) ;
79
+ apiGqlCompile ( projectRoot ) ;
75
80
await generateModels ( projectRoot ) ;
76
81
await generateStatementsAndTypes ( projectRoot ) ;
77
82
await writeFileSync ( path . join ( projectRoot , 'src' , 'API.ts' ) , 'foo\nbar' ) ;
0 commit comments