-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathtest-initialization-service.ts
29 lines (22 loc) · 1.1 KB
/
test-initialization-service.ts
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
import * as path from "path";
import { cache } from "../common/decorators";
export class TestInitializationService implements ITestInitializationService {
private configsPath = path.join(__dirname, "..", "..", "config");
constructor(private $fs: IFileSystem) { }
@cache()
public getDependencies(selectedFramework: string): string[] {
const dependenciesPath = path.join(this.configsPath, "test-dependencies.json");
const allDependencies: { name: string, framework: string }[] = this.$fs.readJson(dependenciesPath);
const targetFrameworkDependencies: string[] = allDependencies
.filter(dependency => !dependency.framework || dependency.framework === selectedFramework)
.map(dependency => dependency.name);
return targetFrameworkDependencies;
}
@cache()
public getDependenciesVersions(): IDictionary<string> {
const dependenciesVersionsPath = path.join(this.configsPath, "test-deps-versions-generated.json");
const dependenciesVersions = this.$fs.readJson(dependenciesVersionsPath);
return dependenciesVersions;
}
}
$injector.register("testInitializationService", TestInitializationService);