All files getLessFiles.ts

100% Statements 5/5
100% Branches 1/1
100% Functions 3/3
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14      4x 4x 4x     6x   4x      
import dirTree from 'directory-tree';
 
export function getLessFiles(folder: string, reg = /\.(less|css)$/) {
  return new Promise<Array<string>>((resolve, reject) => {
    const lessPaths: Array<string> = [];
    dirTree(folder, {
      extensions: reg
    }, (item) => {
      lessPaths.push(item.path);
    });
    resolve(lessPaths);
  });
}