File tree 3 files changed +42
-14
lines changed
fixtures/travis-ymls/testing-imports
3 files changed +42
-14
lines changed Original file line number Diff line number Diff line change @@ -25,25 +25,27 @@ internals.toArray = (v) => {
25
25
26
26
internals . normalizeImports = ( travisYaml , { relativeTo } ) => {
27
27
28
- return internals . toArray ( travisYaml . import ) . map ( ( entry ) => {
28
+ return internals . toArray ( travisYaml . import )
29
+ . map ( ( entry ) => {
29
30
30
- if ( typeof entry === 'string' ) {
31
- entry = { source : entry } ;
32
- }
31
+ if ( typeof entry === 'string' ) {
32
+ entry = { source : entry } ;
33
+ }
33
34
34
- if ( entry . source . startsWith ( './' ) ) {
35
- entry . source = entry . source . substring ( 2 ) ;
35
+ if ( entry . source . startsWith ( './' ) ) {
36
+ entry . source = entry . source . substring ( 2 ) ;
36
37
37
- if ( relativeTo ) {
38
- const relativeParts = relativeTo . source . split ( '/' ) ;
39
- relativeParts . pop ( ) ;
40
- relativeParts . push ( entry . source ) ;
41
- entry . source = relativeParts . join ( '/' ) ;
38
+ if ( relativeTo ) {
39
+ const relativeParts = relativeTo . source . split ( '/' ) ;
40
+ relativeParts . pop ( ) ;
41
+ relativeParts . push ( entry . source ) ;
42
+ entry . source = relativeParts . join ( '/' ) ;
43
+ }
42
44
}
43
- }
44
45
45
- return entry ;
46
- } ) ;
46
+ return entry ;
47
+ } )
48
+ . filter ( ( entry ) => ! entry . if ) ; // @todo : log a warning
47
49
} ;
48
50
49
51
Original file line number Diff line number Diff line change
1
+ language : node_js
2
+ import :
3
+ - source : partials/indirect-node-14.yml
4
+ if : branch = master
Original file line number Diff line number Diff line change @@ -103,4 +103,26 @@ describe('.travis.yml parsing', () => {
103
103
} ) ;
104
104
} ) ;
105
105
106
+ it ( 'ignores conditional imports' , async ( ) => {
107
+
108
+ await fixture . setupRepoFolder ( {
109
+ partials : true ,
110
+ travisYml : `testing-imports/conditional.yml`
111
+ } ) ;
112
+
113
+ const result = await NodeSupport . detect ( { path : fixture . path } ) ;
114
+
115
+ internals . assertCommit ( result ) ;
116
+
117
+ expect ( result ) . to . equal ( {
118
+ name : 'test-module' ,
119
+ version : '0.0.0-development' ,
120
+ timestamp : 1580673602000 ,
121
+ travis : {
122
+ raw : [ 'latest' ] ,
123
+ resolved : { 'latest' : '13.14.0' }
124
+ }
125
+ } ) ;
126
+ } ) ;
127
+
106
128
} ) ;
You can’t perform that action at this time.
0 commit comments