Skip to content

Commit 8b45fe7

Browse files
committed
Fix tests
1 parent dc3ea73 commit 8b45fe7

File tree

3 files changed

+12
-16
lines changed

3 files changed

+12
-16
lines changed

lib/helpers/get-paths-sync.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ module.exports = function getPathsSync(patterns, ignore, disableGlobs) {
1515
return patterns;
1616
}
1717

18-
//Return paths
19-
return patterns.map(pattern => glob.sync(pattern, {ignore, nodir: true}));
18+
//Get paths
19+
const paths = patterns
20+
.map(pattern => glob.sync(pattern, {ignore, nodir: true}));
21+
22+
//Return flattened
23+
return [].concat.apply([], paths);
2024
};

lib/helpers/parse-config.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ module.exports = function parseConfig(config) {
3535
if (typeof to === 'undefined') {
3636
throw new Error('Must specify a replacement (can be blank string)');
3737
}
38-
if (typeof ignore === 'undefined') {
39-
config.ignore = [];
40-
}
4138

4239
//Ensure arrays
4340
if (!Array.isArray(files)) {
4441
config.files = [files];
4542
}
4643
if (!Array.isArray(ignore)) {
47-
config.ignore = [ignore];
44+
if (typeof ignore === 'undefined') {
45+
config.ignore = [];
46+
}
47+
else {
48+
config.ignore = [ignore];
49+
}
4850
}
4951

5052
//Use default encoding if invalid

lib/replace-in-file.spec.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -550,16 +550,6 @@ describe('Replace in file', () => {
550550
}).to.throw(Error);
551551
});
552552

553-
it('should support `replace` and `with` params for now', () => {
554-
expect(function() {
555-
replace.sync({
556-
files: 'test1',
557-
replace: /re\splace/g,
558-
with: 'b',
559-
});
560-
}).to.not.throw(Error);
561-
});
562-
563553
it('should support the encoding parameter', () => {
564554
expect(function() {
565555
replace.sync({

0 commit comments

Comments
 (0)