Permalink
Browse files

Removed nodeunit test cases

  • Loading branch information...
1 parent c0a47d0 commit f0906d9637235f29ae301fbc8f5340e657f4aa22 @vkadam committed Jan 27, 2015
Showing with 4 additions and 242 deletions.
  1. +1 −76 Gruntfile.js
  2. +3 −3 package.json
  3. +0 −58 test/configFile_test.js
  4. +0 −16 test/dest_test.js
  5. +0 −28 test/fileMapping_test.js
  6. +0 −18 test/force_test.js
  7. +0 −43 test/mode_test.js
View
@@ -12,78 +12,6 @@ module.exports = function(grunt) {
jsbeautifier: {
default: {
src: ["<%= jshint.files %>", "!test/fixtures/**", "package.json"]
- },
- successWithForce: {
- src: ["tmp/verifyMode/not-been-beautified.js", "tmp/verifyMode/not-been-beautified.css"],
- options: {
- mode: "VERIFY_ONLY"
- }
- },
- hasNotBeenBeautified: {
- src: ["tmp/verifyMode/not-been-beautified.js", "tmp/verifyMode/not-been-beautified.css"],
- options: {
- mode: "VERIFY_ONLY"
- }
- },
- hasBeenBeautified: {
- src: ["tmp/verifyMode/been-beautified.js"],
- options: {
- mode: "VERIFY_ONLY"
- }
- },
- fileMapping: {
- src: ["tmp/fileMapping/not-beautified.js.erb",
- "tmp/fileMapping/not-beautified.css.erb", "tmp/fileMapping/not-beautified.html.erb"
- ],
- options: {
- js: {
- fileTypes: [".js.erb"],
- maxPreserveNewlines: 2
- },
- css: {
- fileTypes: [".css.erb"]
- },
- html: {
- fileTypes: [".html.erb"],
- preserveNewLines: true,
- maxPreserveNewlines: 1
- }
- }
- },
- configFile: {
- src: ["tmp/configFile/test.js",
- "tmp/configFile/test.css", "tmp/configFile/test.html"
- ],
- options: {
- config: "tmp/configFile/jsbeautifyrc.json"
- }
- },
- configFileFlat: {
- src: "<%= jsbeautifier.configFile.src %>",
- options: {
- config: "tmp/configFile/jsbeautifyrc_flat.json"
- }
- },
- configFileWithGruntFileOptions: {
- src: "<%= jsbeautifier.configFile.src %>",
- options: {
- config: "tmp/configFile/jsbeautifyrc_flat.json",
- js: {
- indentSize: 3
- },
- css: {
- indentSize: 5
- },
- html: {
- indentSize: 7
- }
- }
- },
- dest: {
- src: ["tmp/common/not-been-beautified.js"],
- options: {
- dest: "dest"
- }
}
},
copy: {
@@ -95,9 +23,6 @@ module.exports = function(grunt) {
}
},
clean: ["tmp", "dest"],
- nodeunit: {
- all: ["test/**/*_test.js"]
- },
mochaTest: {
test: {
options: {
@@ -124,6 +49,6 @@ module.exports = function(grunt) {
grunt.loadTasks("tasks");
// By default, beautify, lint and run all tests.
- grunt.registerTask("test", ["jshint", "copy", "nodeunit", "clean", "mochaTest"]);
+ grunt.registerTask("test", ["jshint", "copy", "clean", "mochaTest"]);
grunt.registerTask("default", ["devUpdate", "test", "jsbeautifier:default"]);
};
View
@@ -31,11 +31,11 @@
"chai": "^1.9.2",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^0.7.0",
- "grunt-contrib-jshint": "^0.10.0",
+ "grunt-contrib-jshint": "^0.11.0",
"grunt-contrib-nodeunit": "^0.4.1",
- "grunt-dev-update": "^0.9.0",
+ "grunt-dev-update": "^1.0.2",
"grunt-mocha-test": "^0.12.1",
- "load-grunt-tasks": "^0.6.0",
+ "load-grunt-tasks": "^3.0.0",
"ncp": "^1.0.1"
},
"scripts": {
@@ -1,58 +0,0 @@
-"use strict";
-
-var grunt = require("grunt"),
- exec = require("child_process").exec;
-
-function beautifyAndassert(test, task, actualFile, expectedFile) {
- exec("grunt " + task, function() {
- var actual = grunt.file.read("tmp/configFile/" + actualFile),
- expected = grunt.file.read("tmp/configFile/" + expectedFile);
- test.equal(actual, expected, "should beautify js " + actualFile + " using config file");
- test.done();
- });
-}
-
-exports.configFile_test = {
- "beautification of js file using settings from config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFile", "test.js", "expected/test_expected.js");
- },
- "beautification of css file using settings from config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFile", "test.css", "expected/test_expected.css");
- },
- "beautification of html file using settings from config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFile", "test.html", "expected/test_expected.html");
- }
-};
-
-exports.configFile_flat_test = {
- "beautification of js file using settings from flat config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileFlat", "test.js", "expected/test_expected.js");
- },
- "beautification of css file using settings from flat config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileFlat", "test.css", "expected/test_expected.css");
- },
- "beautification of html file using settings from flat config file": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileFlat", "test.html", "expected/test_expected.html");
- }
-};
-
-exports.configFile_with_gruntfile_options_test = {
- "beautification of js file using settings from config file and gruntfile": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileWithGruntFileOptions", "test.js", "expected/withGruntFileOptions/test_expected.js");
- },
- "beautification of css file using settings from config file and gruntfile": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileWithGruntFileOptions", "test.css", "expected/withGruntFileOptions/test_expected.css");
- },
- "beautification of html file using settings from config file and gruntfile": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:configFileWithGruntFileOptions", "test.html", "expected/withGruntFileOptions/test_expected.html");
- }
-};
View
@@ -1,16 +0,0 @@
-"use strict";
-
-var grunt = require("grunt"),
- exec = require("child_process").exec;
-
-exports.dest_test = {
- "Verify beautification with dest folder": function(test) {
- test.expect(1);
- exec("grunt jsbeautifier:dest", function() {
- var actual = grunt.file.read("dest/tmp/common/not-been-beautified.js"),
- expected = grunt.file.read("test/fixtures/common/been-beautified.js");
- test.equal(actual, expected, "should beautify js using config file");
- test.done();
- });
- }
-};
@@ -1,28 +0,0 @@
-"use strict";
-
-var grunt = require("grunt"),
- exec = require("child_process").exec;
-
-function beautifyAndassert(test, task, actualFile, expectedFile) {
- exec("grunt " + task, function() {
- var actual = grunt.file.read("tmp/fileMapping/" + actualFile),
- expected = grunt.file.read("tmp/fileMapping/" + expectedFile);
- test.equal(actual, expected, "should beautify js " + actualFile + " using config file");
- test.done();
- });
-}
-
-exports.fileMapping_test = {
- "beautification of js file using file mapping": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.js.erb", "expected/beautified.js.erb");
- },
- "beautification of css file using file mapping": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.css.erb", "expected/beautified.css.erb");
- },
- "beautification of html file using file mapping": function(test) {
- test.expect(1);
- beautifyAndassert(test, "jsbeautifier:fileMapping", "not-beautified.html.erb", "expected/beautified.html.erb");
- }
-};
View
@@ -1,18 +0,0 @@
-"use strict";
-
-var exec = require("child_process").exec;
-
-exports.mode_test = {
-
- "passes with force option": function(test) {
- test.expect(2);
- exec("grunt jsbeautifier:successWithForce --force", {
- cwd: __dirname + "/../"
- },
- function(err, stdout) {
- test.ok(stdout.indexOf("are not beautified") > -1, "Error message is logged");
- test.equals(err, null, "Grunt passes because file has been beautified");
- test.done();
- });
- }
-};
View
@@ -1,43 +0,0 @@
-"use strict";
-
-var exec = require("child_process").exec;
-
-exports.mode_test = {
- "Verify beautification with unbeautified file": function(test) {
- test.expect(3);
- exec("grunt jsbeautifier:hasNotBeenBeautified", {
- cwd: __dirname + "/../"
- },
- function(err, stdout) {
- test.notEqual(err, null, "Grunt fails because file has not been beautified");
- test.ok(stdout.indexOf("are not beautified") > -1, "Error message is logged");
- test.ok(stdout.indexOf("tmp/verifyMode/not-been-beautified.js") > -1, "Error message with filename is logged");
- test.done();
- });
- },
-
- "Verify beautification with multiple unbeautified file": function(test) {
- test.expect(4);
- exec("grunt jsbeautifier:hasNotBeenBeautified", {
- cwd: __dirname + "/../"
- },
- function(err, stdout) {
- test.notEqual(err, null, "Grunt fails because file has not been beautified");
- test.ok(stdout.indexOf("are not beautified") > -1, "Error message is logged");
- test.ok(stdout.indexOf("tmp/verifyMode/not-been-beautified.js") > -1, "Error message with js filename is logged");
- test.ok(stdout.indexOf("tmp/verifyMode/not-been-beautified.css") > -1, "Error message with css filename is logged");
- test.done();
- });
- },
-
- "Verify beautification with beautified file": function(test) {
- test.expect(1);
- exec("grunt jsbeautifier:hasBeenBeautified", {
- cwd: __dirname + "/../"
- },
- function(err) {
- test.equal(err, null, "Grunt passes because file has been beautified");
- test.done();
- });
- }
-};

0 comments on commit f0906d9

Please sign in to comment.