Skip to content

Commit 09263cf

Browse files
committed
[builder][INTERNAL] TaskUtil: Support specVersion 2.3
New specVersion does not affect TaskUtil but still needs to be supported and handled.
1 parent 984d7a9 commit 09263cf

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

packages/builder/lib/tasks/TaskUtil.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ class TaskUtil {
144144
};
145145
switch (specVersion) {
146146
case "2.2":
147+
case "2.3":
147148
return baseInterface;
148149
default:
149150
throw new Error(`TaskUtil: Unknown or unsupported Specification Version ${specVersion}`);

packages/builder/test/lib/tasks/TaskUtil.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,32 @@ test("getInterface: specVersion 2.2", async (t) => {
146146
t.is(typeof interfacedTaskUtil.registerCleanupTask, "function", "function registerCleanupTask is provided");
147147
});
148148

149+
test("getInterface: specVersion 2.3", async (t) => {
150+
const taskUtil = new TaskUtil({
151+
projectBuildContext: {
152+
STANDARD_TAGS: ["some tag"]
153+
}
154+
});
155+
156+
const interfacedTaskUtil = taskUtil.getInterface("2.3");
157+
158+
t.deepEqual(Object.keys(interfacedTaskUtil), [
159+
"STANDARD_TAGS",
160+
"setTag",
161+
"clearTag",
162+
"getTag",
163+
"isRootProject",
164+
"registerCleanupTask"
165+
], "Correct methods are provided");
166+
167+
t.deepEqual(interfacedTaskUtil.STANDARD_TAGS, ["some tag"], "attribute STANDARD_TAGS is provided");
168+
t.is(typeof interfacedTaskUtil.setTag, "function", "function setTag is provided");
169+
t.is(typeof interfacedTaskUtil.clearTag, "function", "function clearTag is provided");
170+
t.is(typeof interfacedTaskUtil.getTag, "function", "function getTag is provided");
171+
t.is(typeof interfacedTaskUtil.isRootProject, "function", "function isRootProject is provided");
172+
t.is(typeof interfacedTaskUtil.registerCleanupTask, "function", "function registerCleanupTask is provided");
173+
});
174+
149175
test("getInterface: specVersion undefined", async (t) => {
150176
const taskUtil = new TaskUtil({
151177
projectBuildContext: {

0 commit comments

Comments
 (0)