diff --git a/.bowerrc b/.bowerrc new file mode 100644 index 0000000..6866ac2 --- /dev/null +++ b/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "vendor" +} diff --git a/index.js b/index.js index 91c6725..3f3c16b 100644 --- a/index.js +++ b/index.js @@ -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' }); + } } + }; diff --git a/vendor/ember-suave/qunit-configuration.js b/vendor/ember-suave/qunit-configuration.js new file mode 100644 index 0000000..95ccc23 --- /dev/null +++ b/vendor/ember-suave/qunit-configuration.js @@ -0,0 +1,4 @@ +/* globals QUnit */ +if (QUnit) { + QUnit.config.urlConfig.push({ id: 'nojscs', label: 'Disable JSCS' }); +} diff --git a/vendor/ember-suave/test-loader.js b/vendor/ember-suave/test-loader.js new file mode 100644 index 0000000..5a192a9 --- /dev/null +++ b/vendor/ember-suave/test-loader.js @@ -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); + } + +});