Skip to content

Commit

Permalink
Fix #3265
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat committed Apr 25, 2024
1 parent 55cdb25 commit 7044ec6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Util/ProjectTemplateFormats.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ProjectTemplateFormats {

#normalize(formats) {
if (Array.isArray(formats)) {
return formats.map((entry) => entry.trim());
formats = "" + formats.join(",");
}

if (typeof formats !== "string") {
Expand Down
12 changes: 12 additions & 0 deletions test/TemplateConfigTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,18 @@ test("both setTemplateFormats and addTemplateFormats", async (t) => {
t.deepEqual(cfg.templateFormats, ["pug", "vue"]);
});

test("addTemplateFormats() Array", async (t) => {
let templateCfg = new TemplateConfig(defaultConfig, "./test/stubs/config.cjs");
templateCfg.userConfig.addTemplateFormats("vue2");
templateCfg.userConfig.addTemplateFormats(["vue"]);
templateCfg.userConfig.addTemplateFormats(["text", "txt"]);
await templateCfg.init();

let cfg = templateCfg.getConfig();
// should have ALL of the original defaults
t.deepEqual(cfg.templateFormats, ["md", "njk", "vue2", "vue", "text", "txt"]);
});

test("libraryOverrides", async (t) => {
let mdLib = md();
let templateCfg = new TemplateConfig(defaultConfig, "./test/stubs/config.cjs");
Expand Down

0 comments on commit 7044ec6

Please sign in to comment.