-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX lts] blueprints: fix framework detection to work with prerelease versions of ember-cli-mocha #15935
Conversation
@rwjblue I think we can make this |
BTW, it just came to my mind that these last two changes (support But just wondered how. I don't think it makes sense to add them for each and every blueprint test case, making the number of permutations explode. But maybe just something like a smoke test, by adding those cases to one blueprint, e.g. |
Ya, I think so |
3a9833a
to
5aba2bb
Compare
done! [ |
I would probably split things up and unit test the specific logic. Something like: function detectType(dependencies, root) {
if ('ember-qunit' in dependencies || 'ember-cli-qunit' in dependencies) {
type = 'qunit';
} else if ('ember-mocha' in dependencies) {
type = 'mocha-0.12';
} else if ('ember-cli-mocha' in dependencies) {
var checker = new VersionChecker({ root });
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 type;
}
module.exports = function(blueprint) {
blueprint.supportsAddon = function() {
return false;
};
blueprint.filesPath = function() {
var dependencies = this.project.dependencies();
var type = detectType(dependencies, this.project.root);
return path.join(this.path, type + '-files');
};
return blueprint;
};
module.exports._detectType = detectType; This way you can pass any number of different permutations along with something like |
…ase versions of ember-cli-mocha `semver.satisfies` does not cover prerelease versions like `*.*.*-beta` as required, so use `gte`
5aba2bb
to
eb45abe
Compare
Sorry for the rebase issues @simonihmig, thanks for the quick turn around. |
semver.satisfies
does not cover prerelease versions like*.*.*-beta
as required, so usegte
cc @Turbo87