-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathindex.js
56 lines (53 loc) · 1.31 KB
/
index.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
'use strict';
const path = require('path');
const FeatureParser = require('./lib/feature-parser');
module.exports = {
name: require('./package').name,
options: {
autoImport: {
exclude: ['mocha'],
webpack: {
resolve: {
fallback: {
fs: false,
path: false,
process: false,
},
},
node: {
global: true,
},
},
},
},
getTestFramework() {
let dependencies = this.project.dependencies();
if ('ember-cli-mocha' in dependencies || 'ember-mocha' in dependencies) {
return 'mocha';
} else {
return 'qunit';
}
},
setupPreprocessorRegistry(type, registry) {
let testFramework = this.getTestFramework();
let self = this;
registry.add('js', {
name: 'ember-cli-yadda',
ext: ['feature', 'spec', 'specification'],
toTree(tree) {
return new FeatureParser(tree, testFramework, self._options);
},
});
},
blueprintsPath() {
return path.join(__dirname, 'blueprints', this.getTestFramework());
},
included(app) {
this._super.included.apply(this, arguments);
let options = app.options['ember-cli-yadda'] || {};
if (typeof options.persist === 'undefined') {
options.persist = true;
}
this._options = options;
},
};