-
Notifications
You must be signed in to change notification settings - Fork 101
Expand file tree
/
Copy pathbuildTask.test.ts
More file actions
69 lines (61 loc) · 2.18 KB
/
Copy pathbuildTask.test.ts
File metadata and controls
69 lines (61 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as assert from "assert";
import { Task, tasks, TaskScope } from "vscode";
import { BuildTaskProvider, categorizePaths, getFinalPaths } from "../../extension.bundle";
import { setupTestEnv } from "../shared";
// tslint:disable: only-arrow-functions
// tslint:disable: no-object-literal-type-assertion
// tslint:disable: no-invalid-template-strings
suite("Build Task Tests", () => {
suiteSetup(setupTestEnv);
test("test providing default build task", async function() {
this.timeout(60 * 1000 * 3);
const vscodeTasks: Task[] = await tasks.fetchTasks();
const exportJarTask: Task | undefined = vscodeTasks.find((t: Task) => {
return t.name === BuildTaskProvider.defaultTaskName
&& t.source === BuildTaskProvider.type;
});
assert.ok(exportJarTask !== undefined);
});
test("test categorizePaths()", async function() {
const [includes, excludes, invalid] = categorizePaths([
BuildTaskProvider.workspace,
"a/b/c",
"!foo"
], TaskScope.Workspace);
assert.deepStrictEqual(includes.length, 2);
assert.deepStrictEqual(excludes.length, 1);
assert.deepStrictEqual(invalid.length, 0);
});
test("test getFinalPaths() 1", async function() {
const [result, invalid] = getFinalPaths([
BuildTaskProvider.workspace,
"a/b/c",
], [
"foo/bar",
], [
"a/b/c",
"foo/bar",
"test/path"
]);
assert.deepStrictEqual(result.length, 2);
assert.deepStrictEqual(invalid.length, 0);
});
test("test getFinalPaths() 2", async function() {
const [result, invalid] = getFinalPaths([
"a/b/c",
"non/exist2"
], [
"foo/bar",
"non/exist"
], [
"a/b/c",
"foo/bar",
"test/path"
]);
assert.deepStrictEqual(result.length, 1);
assert.deepStrictEqual(invalid.length, 1);
assert.deepStrictEqual(invalid[0], "non/exist2");
});
});