File tree Expand file tree Collapse file tree
tests/test-cases/needs-not-array Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -129,6 +129,7 @@ export function needsComplex (data: any) {
129129export function needsEach ( jobName : string , gitlabData : any ) {
130130 const jobData = gitlabData [ jobName ] ;
131131 if ( ! jobData . needs ) return ;
132+ assert ( Array . isArray ( jobData . needs ) , chalk `{blueBright ${ jobName } } {yellow needs:} must be an array` ) ;
132133
133134 for ( const [ i , n ] of Object . entries < any > ( jobData . needs ) ) {
134135 jobData . needs [ i ] = needsComplex ( n ) ;
Original file line number Diff line number Diff line change 1+ ---
2+ build-job :
3+ script :
4+ - echo "build"
5+
6+ dev-job :
7+ needs : build-job
8+ script :
9+ - echo "dev"
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+ import chalk from "chalk-template" ;
6+
7+ beforeAll ( ( ) => {
8+ initSpawnSpy ( WhenStatics . all ) ;
9+ } ) ;
10+
11+ test . concurrent ( "needs-not-array <dev-job>" , async ( ) => {
12+ const writeStreams = new WriteStreamsMock ( ) ;
13+
14+ await expect ( handler ( {
15+ cwd : "tests/test-cases/needs-not-array" ,
16+ stateDir : ".gitlab-ci-local-needs-not-array" ,
17+ } , writeStreams ) ) . rejects . toThrow ( chalk `{blueBright dev-job} {yellow needs:} must be an array` ) ;
18+ } ) ;
You can’t perform that action at this time.
0 commit comments