Permalink
Browse files

Fixed requirejs version checking test

  • Loading branch information...
1 parent 681c61b commit 092615eb684989b70d520aa21ee39cbabe72df96 @asciidisco committed Mar 21, 2013
Showing with 29 additions and 4 deletions.
  1. +21 −0 Gruntfile.js
  2. +1 −1 lib/optimize.js
  3. +5 −2 package.json
  4. +2 −1 test/require_test.js
View
@@ -72,6 +72,25 @@ module.exports = function(grunt) {
all: ['examples/**/tests/*.html']
},
+ complexity: {
+ generic: {
+ src: ['grunt.js', 'tasks/**/*.js', 'test/require_test.js', 'lib/**/*.js'],
+ options: {
+ errorsOnly: false,
+ cyclomatic: 10,
+ halstead: 10,
+ maintainability: 100
+ }
+ }
+ },
+
+ plato: {
+ bc: {
+ src: ['grunt.js', 'tasks/**/*.js', 'test/require_test.js', 'lib/**/*.js'],
+ dest: 'docs/complexity'
+ }
+ },
+
watch: {
files: '<config:lint.files>',
tasks: 'default'
@@ -141,6 +160,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-contrib-qunit');
+ grunt.loadNpmTasks('grunt-complexity');
+ grunt.loadNpmTasks('grunt-plato');
// Setup the test environment task.
grunt.registerTask('setUp', ['buildExampleProjects', 'copy', 'requirejs']);
View
@@ -22,7 +22,7 @@ exports.init = function(grunt) {
// Runs the requirejs optimizer
// collects the fileSizes (before & after optimization)
// is capable of running so called 'hybrid' build (e.g. running both - uglify & closure compiler)
- return function(config) {
+ return function xxx(config) {
var deferred = Q.defer();
var hybridBuilds = false;
var pathMap = {};
View
@@ -37,15 +37,18 @@
"temp": "0.4.x",
"grunt-lodashbuilder": "0.1.x",
"grunt-jquerybuilder": "0.1.x",
- "grunt-backbonebuilder": "0.1.x"
+ "grunt-backbonebuilder": "0.1.x",
+ "grunt-complexity": "latest",
+ "grunt-plato": "latest"
},
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-copy": "~0.4.0",
"grunt-contrib-jshint": "~0.1.1",
"grunt-contrib-nodeunit": "~0.1.2",
- "grunt-contrib-qunit": "~0.1.1"
+ "grunt-contrib-qunit": "~0.1.1",
+ "semver": "1.1.4"
},
"peerDependencies": {
"grunt": "~0.4.0"
View
@@ -78,9 +78,10 @@ exports['require'] = {
var rjs = rjsversion.getRequirejs(config);
var version = rjsversion.getRequirejsVersionInfo();
var isCustom = rjsversion.isCustomLibrary();
+ var senver = require('semver');
test.equal((typeof rjs === 'function'), true, 'Default library is used if no config given');
- test.equal(version, '2.1.4', 'Version is current');
+ test.ok(semver.satisfies(version, '2.1.x'), 'Version is current');
test.equal(isCustom, false, 'Default library is used if no config given');
test.done();

0 comments on commit 092615e

Please sign in to comment.