feat(core): add option to skip serve step for cypress builder
The builder currently supports skipping the serve step by passing an empty value for devServerTarget. This is not intuitive and makes configuring this via the command line messy. This flag has the same behavior as passing an empty devServerTarget but is more user-friendly. This option can be useful for CI purposes where applications are previously built and want to use the same configuration for e2e testing but the serve step is unnecessary. ISSUES CLOSED: #3744
This commit is contained in:
parent
8088f20df7
commit
564a86e096
@ -104,6 +104,14 @@ Type: `string`
|
||||
|
||||
The reporter options used. Supported options depend on the reporter.
|
||||
|
||||
### skipServe
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip dev-server build.
|
||||
|
||||
### spec
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -105,6 +105,14 @@ Type: `string`
|
||||
|
||||
The reporter options used. Supported options depend on the reporter.
|
||||
|
||||
### skipServe
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip dev-server build.
|
||||
|
||||
### spec
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -105,6 +105,14 @@ Type: `string`
|
||||
|
||||
The reporter options used. Supported options depend on the reporter.
|
||||
|
||||
### skipServe
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `boolean`
|
||||
|
||||
Skip dev-server build.
|
||||
|
||||
### spec
|
||||
|
||||
Type: `string`
|
||||
|
||||
@ -22,15 +22,17 @@ describe('Cypress builder', () => {
|
||||
record: false,
|
||||
baseUrl: undefined,
|
||||
watch: false,
|
||||
skipServe: false,
|
||||
};
|
||||
let mockContext;
|
||||
let mockedInstalledCypressVersion: jest.Mock<
|
||||
ReturnType<typeof installedCypressVersion>
|
||||
> = installedCypressVersion as any;
|
||||
mockContext = { root: '/root', workspace: { projects: {} } } as any;
|
||||
let runExecutor: any;
|
||||
|
||||
beforeEach(async () => {
|
||||
(devkit as any).runExecutor = jest.fn().mockReturnValue([
|
||||
runExecutor = (devkit as any).runExecutor = jest.fn().mockReturnValue([
|
||||
{
|
||||
success: true,
|
||||
baseUrl: 'http://localhost:4200',
|
||||
@ -172,6 +174,7 @@ describe('Cypress builder', () => {
|
||||
record: false,
|
||||
baseUrl: undefined,
|
||||
watch: false,
|
||||
skipServe: false,
|
||||
},
|
||||
mockContext
|
||||
);
|
||||
@ -261,4 +264,25 @@ describe('Cypress builder', () => {
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should call `Cypress.run` without serving the app', async (done) => {
|
||||
const { success } = await cypressExecutor(
|
||||
{
|
||||
...cypressOptions,
|
||||
skipServe: true,
|
||||
baseUrl: 'http://my-distant-host.com',
|
||||
},
|
||||
mockContext
|
||||
);
|
||||
expect(success).toEqual(true);
|
||||
expect(runExecutor).not.toHaveBeenCalled();
|
||||
expect(cypressRun).toHaveBeenCalledWith(
|
||||
jasmine.objectContaining({
|
||||
config: {
|
||||
baseUrl: 'http://my-distant-host.com',
|
||||
},
|
||||
})
|
||||
);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
@ -32,6 +32,7 @@ export interface CypressExecutorOptions extends Json {
|
||||
ignoreTestFiles?: string;
|
||||
reporter?: string;
|
||||
reporterOptions?: string;
|
||||
skipServe: boolean;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -106,7 +107,7 @@ async function* startDevServer(
|
||||
context: ExecutorContext
|
||||
) {
|
||||
// no dev server, return the provisioned base url
|
||||
if (!opts.devServerTarget) {
|
||||
if (!opts.devServerTarget || opts.skipServe) {
|
||||
yield opts.baseUrl;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,6 +86,11 @@
|
||||
"reporterOptions": {
|
||||
"type": "string",
|
||||
"description": "The reporter options used. Supported options depend on the reporter."
|
||||
},
|
||||
"skipServe": {
|
||||
"type": "boolean",
|
||||
"description": "Skip dev-server build.",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": true,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user