File tree Expand file tree Collapse file tree 4 files changed +63
-1
lines changed
angular_devkit/build_angular Expand file tree Collapse file tree 4 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 16521652 "type" : " string" ,
16531653 "description" : " Dev server target to run tests against."
16541654 },
1655+ "grep" : {
1656+ "type" : " string" ,
1657+ "description" : " Execute specs whose names match the pattern, which is internally compiled to a RegExp."
1658+ },
1659+ "invertGrep" : {
1660+ "type" : " boolean" ,
1661+ "description" : " Invert the selection specified by the 'grep' option." ,
1662+ "default" : false
1663+ },
16551664 "specs" : {
16561665 "type" : " array" ,
16571666 "description" : " Override specs in the protractor config." ,
Original file line number Diff line number Diff line change @@ -17,12 +17,23 @@ import * as url from 'url';
1717import { runModuleAsObservableFork } from '../utils' ;
1818import { Schema as ProtractorBuilderOptions } from './schema' ;
1919
20+ interface JasmineNodeOpts {
21+ jasmineNodeOpts : {
22+ grep ?: string ;
23+ invertGrep ?: boolean ;
24+ } ;
25+ }
26+
2027function runProtractor ( root : string , options : ProtractorBuilderOptions ) : Promise < BuilderOutput > {
21- const additionalProtractorConfig : Partial < ProtractorBuilderOptions > = {
28+ const additionalProtractorConfig : Partial < ProtractorBuilderOptions > & Partial < JasmineNodeOpts > = {
2229 elementExplorer : options . elementExplorer ,
2330 baseUrl : options . baseUrl ,
2431 specs : options . specs && options . specs . length ? options . specs : undefined ,
2532 suite : options . suite ,
33+ jasmineNodeOpts : {
34+ grep : options . grep ,
35+ invertGrep : options . invertGrep ,
36+ } ,
2637 } ;
2738
2839 // TODO: Protractor manages process.exit itself, so this target will allways quit the
Original file line number Diff line number Diff line change 1313 "description" : " Dev server target to run tests against." ,
1414 "pattern" : " ^([^:\\ s]+:[^:\\ s]+(:[^\\ s]+)?)?$"
1515 },
16+ "grep" : {
17+ "type" : " string" ,
18+ "description" : " Execute specs whose names match the pattern, which is internally compiled to a RegExp."
19+ },
20+ "invertGrep" : {
21+ "type" : " boolean" ,
22+ "description" : " Invert the selection specified by the 'grep' option." ,
23+ "default" : false
24+ },
1625 "specs" : {
1726 "type" : " array" ,
1827 "description" : " Override specs in the protractor config." ,
Original file line number Diff line number Diff line change @@ -97,4 +97,37 @@ describe('Protractor Builder', () => {
9797 await run . stop ( ) ;
9898 } , 30000 ) ;
9999
100+ it ( 'supports running tests by pattern' , async ( ) => {
101+ host . writeMultipleFiles ( {
102+ 'e2e/app.e2e-spec.ts' : `
103+ it('should succeed', () => expect(true).toBeTruthy());
104+ it('should fail', () => expect(false).toBeTruthy());
105+ ` ,
106+ } ) ;
107+
108+ const overrides = { grep : 'succeed' } ;
109+
110+ const run = await architect . scheduleTarget ( protractorTargetSpec , overrides ) ;
111+
112+ await expectAsync ( run . result ) . toBeResolvedTo ( jasmine . objectContaining ( { success : true } ) ) ;
113+
114+ await run . stop ( ) ;
115+ } , 30000 ) ;
116+
117+ it ( 'supports running tests excluding a pattern' , async ( ) => {
118+ host . writeMultipleFiles ( {
119+ 'e2e/app.e2e-spec.ts' : `
120+ it('should succeed', () => expect(true).toBeTruthy());
121+ it('should fail', () => expect(false).toBeTruthy());
122+ ` ,
123+ } ) ;
124+
125+ const overrides = { grep : 'fail' , invertGrep : true } ;
126+
127+ const run = await architect . scheduleTarget ( protractorTargetSpec , overrides ) ;
128+
129+ await expectAsync ( run . result ) . toBeResolvedTo ( jasmine . objectContaining ( { success : true } ) ) ;
130+
131+ await run . stop ( ) ;
132+ } , 30000 ) ;
100133} ) ;
You can’t perform that action at this time.
0 commit comments