forked from prisma-labs/graphql-framework-experiment
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extracting testing types into folder
- updating test folder to match setup of internal ‘plugin’ library
- Loading branch information
Showing
5 changed files
with
47 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { createTestContext, TestContext } from './testing' | ||
export * from './types' | ||
export { createTestContext } from './testing' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './test-context' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { GraphQLClient } from '../../lib/graphql-client' | ||
|
||
export interface TestContextAppCore { | ||
start(): Promise<void> | ||
stop(): Promise<void> | ||
} | ||
|
||
export interface TestContextCore { | ||
app: TestContextAppCore | ||
client: GraphQLClient | ||
} | ||
|
||
declare global { | ||
interface NexusTestContextApp extends TestContextAppCore {} | ||
|
||
interface NexusTestContextRoot { | ||
app: NexusTestContextApp | ||
client: GraphQLClient | ||
} | ||
} | ||
|
||
export type TestContext = NexusTestContextRoot | ||
|
||
export interface CreateTestContextOptions { | ||
/** | ||
* A path to the entrypoint of your app. Only necessary if the entrypoint falls outside of Nexus conventions. | ||
* You should typically use this if you're using `nexus dev --entrypoint` or `nexus build --entrypoint`. | ||
*/ | ||
entrypointPath?: string | ||
/** | ||
* Nexus usually determines the project root by the first `package.json` found while traversing up the file system. | ||
* In some cases, e.g. usage in a monorepo, this might not always be correct. | ||
* For those cases, you can specify the `projectRoot` manually. | ||
* | ||
* Example: `await createTestContext({ projectRoot: path.join(__dirname, '../..') })` | ||
*/ | ||
projectRoot?: string | ||
} |