Skip to content
Browse files

added test framework

  • Loading branch information...
1 parent 4c047ae commit 9e8f7b8839c9adbf2a4a1dc92df564a00aceb1fc @aearly committed Dec 4, 2012
Showing with 123 additions and 0 deletions.
  1. +2 −0 .gitignore
  2. +14 −0 examples/test/grunt-basic.js
  3. +3 −0 examples/test/lib/A.js
  4. +4 −0 examples/test/lib/B.js
  5. +45 −0 grunt.js
  6. +31 −0 package.json
  7. +10 −0 tasks/gluejs.js
  8. +14 −0 test/all.test.js
View
2 .gitignore
@@ -12,3 +12,5 @@ logs
results
npm-debug.log
+node_modules
+dist
View
14 examples/test/grunt-basic.js
@@ -0,0 +1,14 @@
+module.exports = function (grunt) {
+ "use strict";
+
+ grunt.initConfig({
+ gluejs: {
+ "dist/basic.js": {
+ entries: ["lib/A.js"]
+ }
+ }
+ });
+
+ grunt.loadTasks("../../tasks/");
+ grunt.registerTask("default", "gluejs");
+};
View
3 examples/test/lib/A.js
@@ -0,0 +1,3 @@
+require("./B");
+
+module.exports = "test";
View
4 examples/test/lib/B.js
@@ -0,0 +1,4 @@
+module.exports = function () {
+ "use strict";
+ return "B";
+};
View
45 grunt.js
@@ -0,0 +1,45 @@
+module.exports = function (grunt) {
+ grunt.initConfig({
+ lint: {
+ files: ["grunt.js", "tasks/*.js", "test/*.js", "examples/**/lib/*.js", "examples/**/grunt*.js"]
+ },
+ jshint: {
+ options: {
+ curly: true,
+ eqeqeq: true,
+ immed: true,
+ latedef: true,
+ newcap: true,
+ noarg: true,
+ sub: true,
+ undef: true,
+ boss: true,
+ eqnull: true,
+ node: true,
+ es5: true,
+ strict: false
+ },
+ globals: {
+ define: true,
+ describe: true,
+ it: true
+ }
+ },
+ simplemocha: {
+ all: {
+ src: ["test/*.test.js"],
+ options: {
+ growl: true,
+ reporter: "spec"
+ }
+ }
+ },
+ watch: {
+ files: "<config:lint.files>",
+ tasks: "default"
+ }
+ });
+
+ grunt.loadNpmTasks("grunt-simple-mocha");
+ grunt.registerTask("default", "lint simplemocha");
+};
View
31 package.json
@@ -0,0 +1,31 @@
+{
+ "name": "grunt-gluejs",
+ "version": "0.0.0",
+ "description": "Grunt wrapper for GlueJS",
+ "main": "tasks/gluejs.js",
+ "scripts": {
+ "test": "mocha"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/aearly/grunt-gluejs.git"
+ },
+ "keywords": [
+ "gluejs",
+ "grunt",
+ "task",
+ "commonjs",
+ "browserify"
+ ],
+ "author": "Alexander Early <alexander.early@gmail.com>",
+ "license": "BSD",
+ "devDependencies": {
+ "expect.js": "~0.2.0",
+ "grunt": "~0.3.17",
+ "grunt-simple-mocha": "~0.2.0",
+ "mocha": "~1.7.3"
+ },
+ "dependencies": {
+ "gluejs": "~0.2.0"
+ }
+}
View
10 tasks/gluejs.js
@@ -0,0 +1,10 @@
+var Glue = require("gluejs");
+
+module.exports = function (grunt) {
+ "use strict";
+
+ grunt.registerMultiTask("gluejs", "Build CommonJS-style modules for the browser", function (grunt) {
+
+ });
+
+};
View
14 test/all.test.js
@@ -0,0 +1,14 @@
+var expect = require("expect.js"),
+ fs = require("fs"),
+ exec = require("child_process").exec;
+
+
+describe("Test project 1:", function () {
+ it("should build properly", function (done) {
+ exec("grunt --config " + __dirname + "/../examples/test/grunt-basic.js", function (err, stdout, stderr) {
+ console.log(stderr + stdout);
+ expect(err).to.equal(null);
+ done();
+ });
+ });
+});

0 comments on commit 9e8f7b8

Please sign in to comment.
Something went wrong with that request. Please try again.