Skip to content

Commit

Permalink
Merge pull request #63 from toddjordan/master
Browse files Browse the repository at this point in the history
Add disable jscs option to qunit
  • Loading branch information
brzpegasus committed Sep 11, 2015
2 parents 7c6db41 + 35d700d commit 7e2249a
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .bowerrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"directory": "vendor"
}
13 changes: 10 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
/* jshint node: true */
'use strict';

var JSCSFilter = require('broccoli-jscs');
var jscsrcBuilder = require('./lib/jscsrc-builder');

module.exports = {
name: 'ember-suave',

lintTree: function(type, tree) {
lintTree: function (type, tree) {
var jscsOptions = this.app.options.jscsOptions || {};
jscsOptions.configPath = jscsrcBuilder(this.project);

return new JSCSFilter(tree, jscsOptions);
},

included: function(app) {
this._super.included.apply(this, arguments);
if (app.tests) {
app.import('vendor/ember-suave/qunit-configuration.js', { type: 'test' });
app.import('vendor/ember-suave/test-loader.js', { type: 'test' });
}
}

};
4 changes: 4 additions & 0 deletions vendor/ember-suave/qunit-configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* globals QUnit */
if (QUnit) {
QUnit.config.urlConfig.push({ id: 'nojscs', label: 'Disable JSCS' });
}
15 changes: 15 additions & 0 deletions vendor/ember-suave/test-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* globals jQuery, QUnit */

jQuery(document).ready(function () {
var TestLoaderModule = require('ember-cli/test-loader');
var addModuleExcludeMatcher = TestLoaderModule['addModuleExcludeMatcher'];

function isJscsDisabled() { return QUnit ? QUnit.urlParams.nojscs : false; }
function isAJscsTest(moduleName) { return moduleName.match(/\.jscs-test$/); }
function jscsModuleMatcher(moduleName) { return isJscsDisabled() && isAJscsTest(moduleName); }

if (addModuleExcludeMatcher) {
addModuleExcludeMatcher(jscsModuleMatcher);
}

});

0 comments on commit 7e2249a

Please sign in to comment.