File tree Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Expand file tree Collapse file tree 3 files changed +33
-4
lines changed Original file line number Diff line number Diff line change 33module . exports = {
44 root : true ,
55 parserOptions : {
6- ecmaVersion : 7 ,
7- "ecmaFeatures" : {
8- "experimentalObjectRestSpread" : true ,
9- } ,
6+ ecmaVersion : 9
107 } ,
118 env : {
129 node : true ,
Original file line number Diff line number Diff line change @@ -118,3 +118,18 @@ function realpathOrError(path) {
118118 return e ;
119119 }
120120}
121+
122+ /**
123+ * Inline version of stream to array
124+ *
125+ * @returns {Promise<BemFile[]> }
126+ */
127+ module . exports . asArray = function ( ...args ) {
128+ return new Promise ( ( resolve , reject ) => {
129+ const files = [ ] ;
130+ module . exports ( ...args )
131+ . on ( 'data' , file => files . push ( file ) )
132+ . on ( 'error' , reject )
133+ . on ( 'end' , ( ) => resolve ( files ) ) ;
134+ } ) ;
135+ } ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const { describe, it } = require ( 'mocha' ) ;
4+ const { expect, use } = require ( 'chai' ) ;
5+ use ( require ( 'chai-as-promised' ) ) ;
6+
7+ const { asArray } = require ( '..' ) ;
8+
9+ describe ( 'asArray' , ( ) => {
10+ it ( 'should return an empty array' , async ( ) => {
11+ expect ( await asArray ( [ '.' ] ) ) . to . eql ( [ ] ) ;
12+ } ) ;
13+
14+ it ( 'should throw on incorrect' , async ( ) => {
15+ expect ( asArray ( [ 'unknown-direction' ] ) ) . to . be . rejectedWith ( / E N O E N T / ) ;
16+ } ) ;
17+ } ) ;
You can’t perform that action at this time.
0 commit comments