Skip to content

Commit 90e7306

Browse files
committed
fix: TypeError when watchOptions.ignored is not an array - fixes #1563
1 parent dd70eba commit 90e7306

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/cli/transforms/copyCLIIgnoreToWatchOptions.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export function copyCLIIgnoreToWatchOptions(incoming) {
55
return incoming;
66
}
77
return incoming.updateIn(["watchOptions", "ignored"], List([]), ignored => {
8-
const userIgnore = List([]).concat(incoming.get("ignore"));
9-
return ignored.concat(userIgnore);
8+
return List([]).concat(ignored, incoming.get("ignore"));
109
});
1110
}

test/specs/cli/cli.options.watch.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,17 @@ describe("CLI: Options: Merging Watch Option", function() {
122122
config.getIn(["watchOptions", "ignored"]).contains("*.json2")
123123
);
124124
});
125+
it("merges from server, serveStatic + ignore path + watchOptions.ignore (string)", function() {
126+
var input = {
127+
server: ["."],
128+
watch: true,
129+
ignore: ["*.json", "*.json2"],
130+
watchOptions: { ignored: "*.txt" }
131+
};
132+
var config = merge(input);
133+
134+
assert.ok(config.getIn(["watchOptions", "ignored"]).contains("*.json"));
135+
assert.ok(config.getIn(["watchOptions", "ignored"]).contains("*.json2"));
136+
assert.ok(config.getIn(["watchOptions", "ignored"]).contains("*.txt"));
137+
});
125138
});

0 commit comments

Comments
 (0)