Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests #52

Merged
merged 15 commits into from
Mar 7, 2019
Prev Previous commit
Next Next commit
tolerate apps with no tests
  • Loading branch information
ef4 committed Mar 7, 2019
commit 168a99aee67f44d7c4943a1c60e0e34bd889bcb0
28 changes: 20 additions & 8 deletions packages/compat/src/v1-app.ts
Original file line number Diff line number Diff line change
@@ -364,10 +364,12 @@ export default class V1App implements V1Package {
}));
}

private get testsTree(): Tree {
return this.preprocessJS(new Funnel(this.app.trees.tests, {
destDir: 'tests'
}));
private get testsTree(): Tree | undefined {
if (this.app.trees.tests) {
return this.preprocessJS(new Funnel(this.app.trees.tests, {
destDir: 'tests'
}));
}
}

get vendorTree(): Tree {
@@ -406,17 +408,27 @@ export default class V1App implements V1Package {
let appTree = this.appTree;
let testsTree = this.testsTree;
let lintTree = this.app.getLintTests();
let analyzer = new DependencyAnalyzer([
let importParsers = [
new ImportParser(appTree),
new ImportParser(testsTree),
new ImportParser(lintTree),
], this.packageCache.getApp(this.root));
];
if (testsTree) {
importParsers.push(new ImportParser(testsTree));
}
let analyzer = new DependencyAnalyzer(importParsers, this.packageCache.getApp(this.root));
let config = new WriteV1Config(
this.config,
this.storeConfigInMeta,
this.name
);
let trees = [appTree, this.styleTree, config, testsTree, lintTree];
let trees: Tree[] = [];
trees.push(appTree);
trees.push(this.styleTree);
trees.push(config);
if (testsTree) {
trees.push(testsTree);
}
trees.push(lintTree);
return {
appJS: mergeTrees(trees, { overwrite: true }),
analyzer