File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ # @Description Runs first
3+ firstjob :
4+ script :
5+ - echo "first"
6+
7+ # @Description Upload source maps. Opt in per brand:
8+ # sourcemaps:
9+ # extends: [.foo]
10+ sourcemaps :
11+ script :
12+ - echo "sourcemaps"
13+
14+ # @Description Deploys everything
15+ deploy to prod :
16+ script :
17+ - echo "deploy"
18+
19+ # @Description Builds the image
20+ build/image :
21+ script :
22+ - echo "build"
23+
24+ # @Description Runs the tests
25+ plainjob :
26+ script :
27+ - echo "test"
Original file line number Diff line number Diff line change 1+ import { WriteStreamsMock } from "../../../src/write-streams.js" ;
2+ import { handler } from "../../../src/handler.js" ;
3+ import { initSpawnSpy } from "../../mocks/utils.mock.js" ;
4+ import { WhenStatics } from "../../mocks/when-statics.js" ;
5+
6+ beforeAll ( ( ) => {
7+ initSpawnSpy ( WhenStatics . all ) ;
8+ } ) ;
9+
10+ test . concurrent ( "comment-directive-anchor --list" , async ( ) => {
11+ const writeStreams = new WriteStreamsMock ( ) ;
12+ await handler ( {
13+ cwd : "tests/test-cases/comment-directive-anchor/" ,
14+ list : true ,
15+ noColor : true ,
16+ stateDir : ".gitlab-ci-local-comment-directive-anchor" ,
17+ } , writeStreams ) ;
18+
19+ const descriptionOf = ( jobName : string ) => {
20+ const line = writeStreams . stdoutLines . find ( l => l . startsWith ( `${ jobName } ` ) ) ;
21+ expect ( line , `no output line for job ${ jobName } ` ) . toBeDefined ( ) ;
22+ return line ! . slice ( jobName . length ) . trimStart ( ) . replace ( / \s { 2 , } .* $ / , "" ) ;
23+ } ;
24+
25+ expect ( descriptionOf ( "firstjob" ) ) . toBe ( "Runs first" ) ;
26+ expect ( descriptionOf ( "sourcemaps" ) ) . toBe ( "Upload source maps. Opt in per brand:" ) ;
27+ expect ( descriptionOf ( "deploy to prod" ) ) . toBe ( "Deploys everything" ) ;
28+ expect ( descriptionOf ( "build/image" ) ) . toBe ( "Builds the image" ) ;
29+ expect ( descriptionOf ( "plainjob" ) ) . toBe ( "Runs the tests" ) ;
30+ } ) ;
You can’t perform that action at this time.
0 commit comments