-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
mock-project.js
68 lines (57 loc) · 1.16 KB
/
mock-project.js
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
'use strict';
const Project = require('../../lib/models/project');
const Instrumentation = require('../../lib/models/instrumentation');
const MockUI = require('console-ui/mock');
class MockProject extends Project {
constructor(options = {}) {
let root = options.root || process.cwd();
let pkg = options.pkg || {};
let ui = options.ui || new MockUI();
let instr = new Instrumentation({
ui,
initInstrumentation: {
token: null,
node: null,
},
});
let cli = options.cli || {
instrumentation: instr,
};
super(root, pkg, ui, cli);
}
require(file) {
if (file === './server') {
return function () {
return {
listen() {
arguments[arguments.length - 1]();
},
};
};
}
}
config() {
return (
this._config || {
rootURL: '/',
locationType: 'history',
}
);
}
has(key) {
return /server/.test(key);
}
name() {
return 'mock-project';
}
hasDependencies() {
return true;
}
dependencies() {
return [];
}
isEmberCLIAddon() {
return false;
}
}
module.exports = MockProject;