-
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
225 additions
and
10 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
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
File renamed without changes.
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,33 @@ | ||
const config = require('./jest.config'); | ||
const { jestSupportDir, baseDir } = require('./helpers'); | ||
|
||
const { | ||
clearMocks, | ||
verbose, | ||
moduleFileExtensions, | ||
globals, | ||
transform, | ||
testPathIgnorePatterns, | ||
cacheDirectory, | ||
moduleNameMapper, | ||
} = config; | ||
|
||
module.exports = { | ||
clearMocks, | ||
verbose, | ||
moduleFileExtensions, | ||
globals, | ||
transform, | ||
rootDir: baseDir('support/e2e'), | ||
// coveragePathIgnorePatterns, | ||
testPathIgnorePatterns, | ||
testRegex: '/.*\\.puppeteer\\.ts$', | ||
cacheDirectory, | ||
moduleNameMapper, | ||
name: '@remirror/docz', | ||
displayName: 'docs', | ||
preset: 'jest-puppeteer', | ||
setupFilesAfterEnv: ['expect-puppeteer', jestSupportDir('jest.framework.ts')], | ||
globalSetup: jestSupportDir('jest.puppeteer.setup.ts'), | ||
globalTeardown: jestSupportDir('jest.puppeteer.teardown.ts'), | ||
}; |
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,23 @@ | ||
import { Config } from '@jest/types'; | ||
import { setup as setupDevServer } from 'jest-dev-server'; | ||
|
||
const { setup: setupPuppeteer } = require('jest-environment-puppeteer'); | ||
|
||
export default async function globalSetup(globalConfig: Config.GlobalConfig) { | ||
await setupDevServer([ | ||
{ | ||
command: 'yarn storybook:ci', | ||
port: 6007, | ||
usedPortAction: 'kill', | ||
launchTimeout: 60000, | ||
}, | ||
{ | ||
command: 'yarn next:ci', | ||
port: 3001, | ||
usedPortAction: 'kill', | ||
launchTimeout: 60000, | ||
}, | ||
]); | ||
|
||
await setupPuppeteer(globalConfig); | ||
} |
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,9 @@ | ||
import { Config } from '@jest/types'; | ||
import { teardown as teardownDevServer } from 'jest-dev-server'; | ||
|
||
const { teardown: teardownPuppeteer } = require('jest-environment-puppeteer'); | ||
|
||
export default async function globalTeardown(globalConfig: Config.GlobalConfig) { | ||
await teardownDevServer(); | ||
await teardownPuppeteer(globalConfig); | ||
} |
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,124 @@ | ||
declare module 'jest-dev-server' { | ||
import { WaitOnOptions } from 'wait-on'; | ||
|
||
export interface JestDevServerOptions { | ||
/** | ||
* Command to execute to start the port. Directly passed to spawnd. | ||
* | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start', | ||
* } | ||
* ``` | ||
*/ | ||
command: string; | ||
|
||
/** | ||
* Log server output, useful if server is crashing at start. | ||
* @default false | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start', | ||
* debug: true, | ||
* } | ||
* ``` | ||
*/ | ||
debug?: boolean; | ||
|
||
/** | ||
* How many milliseconds to wait for the spawned server to be available before giving up. Defaults to wait-port's default. | ||
* @default 5000 | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start', | ||
* launchTimeout: 30000, | ||
* } | ||
* ``` | ||
*/ | ||
launchTimeout?: number; | ||
|
||
/** | ||
* Host to wait for activity on before considering the server running. Must be used in conjunction with port. | ||
* @default 'localhost' | ||
* | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start --port 3000', | ||
* host: 'customhost.com', | ||
* port: 3000 | ||
* } | ||
* ``` | ||
*/ | ||
host?: string; | ||
|
||
/** | ||
* To wait for an HTTP or TCP endpoint before considering the server running, include http or tcp as a protocol. Must be used in conjunction with port. | ||
* @default 'tcp' | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start --port 3000', | ||
* protocol: 'http', | ||
* port: 3000, | ||
* } | ||
* ``` | ||
*/ | ||
protocol?: 'https' | 'http' | 'tcp' | 'socket'; | ||
|
||
/** | ||
* Port to wait for activity on before considering the server running. If not provided, the server is assumed to immediately be running. | ||
* @default null | ||
* | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start --port 3000', | ||
* port: 3000, | ||
* } | ||
* ``` | ||
*/ | ||
port?: number; | ||
|
||
/** | ||
* It defines the action to take if port is already used: | ||
* @default 'ask' | ||
* | ||
* - ask: a prompt is shown to decide if you want to kill the process or not | ||
* - error: an errow is thrown | ||
* - ignore: your test are executed, we assume that the server is already started | ||
* - kill: the process is automatically killed without a prompt | ||
* | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start --port 3000', | ||
* port: 3000, | ||
* usedPortAction: 'kill', | ||
* } | ||
*/ | ||
usedPortAction?: 'ask' | 'error' | 'ignore' | 'kill'; | ||
|
||
/** | ||
* jest-dev-server uses the wait-on npm package to wait for resources to become available before calling callback. | ||
* @default {} | ||
* | ||
* ```js | ||
* module.exports = { | ||
* command: 'npm run start --port 3000', | ||
* port: 3000, | ||
* usedPortAction: 'kill', | ||
* waitOnScheme: { | ||
* delay: 1000, | ||
* }, | ||
* } | ||
*/ | ||
waitOnScheme?: Partial<WaitOnOptions>; | ||
} | ||
|
||
export const ERROR_TIMEOUT: 'ERROR_TIMEOUT'; | ||
export const ERROR_PORT_USED: 'ERROR_PORT_USED'; | ||
export const ERROR_NO_COMMAND: 'ERROR_NO_COMMAND'; | ||
|
||
export function setup(options: JestDevServerOptions | JestDevServerOptions[]): Promise<void>; | ||
export function teardown(): Promise<void>; | ||
export function getServers(): Promise<ChildProcess[]>; | ||
|
||
export class JestDevServerError extends Error {} | ||
} |
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
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