Skip to content

Commit

Permalink
increase timeout for CI environments
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock committed Feb 6, 2024
1 parent 8605083 commit 26590f0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/core/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,16 @@ prog
).then(() => {
boostrapCodegen(opts.schema, true)
})
}, 1000)
}, 500)
} else {
setTimeout(() => {
fetch(
`http://localhost:${opts.port}/api/graphql?query={__typename}`,
).then(() => {
console.log('ensuring')
ensureTadaIntrospection(baseDirectory, true)
})
}, 1000)
}, 500)
const hasSrcDir = existsSync(path.resolve(baseDirectory, 'src'))
const base = hasSrcDir
? path.resolve(baseDirectory, 'src')
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/utils/gql-tada.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ export async function ensureTadaIntrospection(

const writeTada = async () => {
try {
console.log(schemaLocation, existsSync(schemaLocation))
const content = await fs.readFile(schemaLocation, 'utf-8')
console.log(content)
const schema = buildSchema(content)
const introspection = introspectionFromSchema(schema, {
descriptions: false,
Expand All @@ -106,7 +108,9 @@ export async function ensureTadaIntrospection(
].join('\n')

await fs.writeFile(outputLocation, contents)
} catch (e) {}
} catch (e) {
console.error(e)
}
}

await writeTada()
Expand Down
8 changes: 4 additions & 4 deletions packages/core/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ describe.each(allFixtures)('%s', (fixtureName) => {
})

// We have a timeout internally to generate the schema of 1 second
await wait(2000)
await wait(3000)

expect(existsSync(path.join(fixtureDir, 'fuse'))).toBe(true)
expect(existsSync(path.join(fixtureDir, 'fuse', 'tada.ts'))).toBe(true)
expect(existsSync(path.join(fixtureDir, 'fuse', 'index.ts'))).toBe(true)
expect(
existsSync(path.join(fixtureDir, 'fuse', 'introspection.ts')),
).toBe(true)
expect(existsSync(path.join(fixtureDir, 'fuse', 'tada.ts'))).toBe(true)
expect(existsSync(path.join(fixtureDir, 'fuse', 'index.ts'))).toBe(true)
}, 10_000)
}, 20_000)
}

test('Should run the build command', async () => {
Expand Down

0 comments on commit 26590f0

Please sign in to comment.