forked from emberjs/ember.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-framework-detector.js
More file actions
57 lines (51 loc) · 1.54 KB
/
test-framework-detector.js
File metadata and controls
57 lines (51 loc) · 1.54 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
'use strict';
const fs = require('fs');
const path = require('path');
const VersionChecker = require('ember-cli-version-checker');
module.exports = function(blueprint) {
blueprint.supportsAddon = function() {
return false;
};
blueprint.filesPath = function() {
let type;
let dependencies = this.project.dependencies();
if ('ember-qunit' in dependencies) {
type = 'qunit-rfc-232';
} else if ('ember-cli-qunit' in dependencies) {
let checker = new VersionChecker(this.project);
if (
fs.existsSync(this.path + '/qunit-rfc-232-files') &&
checker.for('ember-cli-qunit', 'npm').gte('4.2.0')
) {
type = 'qunit-rfc-232';
} else {
type = 'qunit';
}
} else if ('ember-mocha' in dependencies) {
let checker = new VersionChecker(this.project);
if (
fs.existsSync(this.path + '/mocha-rfc-232-files') &&
checker.for('ember-mocha', 'npm').gte('0.14.0')
) {
type = 'mocha-rfc-232';
} else {
type = 'mocha-0.12';
}
} else if ('ember-cli-mocha' in dependencies) {
let checker = new VersionChecker(this.project);
if (
fs.existsSync(this.path + '/mocha-0.12-files') &&
checker.for('ember-cli-mocha', 'npm').gte('0.12.0')
) {
type = 'mocha-0.12';
} else {
type = 'mocha';
}
} else {
this.ui.writeLine("Couldn't determine test style - using QUnit");
type = 'qunit';
}
return path.join(this.path, type + '-files');
};
return blueprint;
};