diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js index 11fc62b..8ffd74e 100644 --- a/gulp/util/karma.conf.js +++ b/gulp/util/karma.conf.js @@ -5,14 +5,13 @@ // base path, that will be used to resolve files and exclude basePath: path.join(__dirname, '..', '..'), - frameworks: ['mocha'], + frameworks: ['browserify', 'mocha', 'chai'], // list of files / patterns to load in the browser files: [ - 'node_modules/chai/chai.js', 'bin/pixi.js', 'test/lib/**/*.js', - 'test/unit/**/*.js', + 'test/unit/{bin,src}/**/*.js', // 'test/functional/**/*.js', { pattern: 'test/**/*.png', @@ -71,6 +70,18 @@ reportSlowerThan: 500, preprocessors : { + 'test/unit/{bin,src}/**/*.js': ['browserify'] + }, + + // browserify configuration + browserify: { + debug: true, + transform: ['brfs'], + configure: function(bundle) { + bundle.on('prebundle', function() { + bundle.external('pixi.js'); + }); + } } }); }; diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js index 11fc62b..8ffd74e 100644 --- a/gulp/util/karma.conf.js +++ b/gulp/util/karma.conf.js @@ -5,14 +5,13 @@ // base path, that will be used to resolve files and exclude basePath: path.join(__dirname, '..', '..'), - frameworks: ['mocha'], + frameworks: ['browserify', 'mocha', 'chai'], // list of files / patterns to load in the browser files: [ - 'node_modules/chai/chai.js', 'bin/pixi.js', 'test/lib/**/*.js', - 'test/unit/**/*.js', + 'test/unit/{bin,src}/**/*.js', // 'test/functional/**/*.js', { pattern: 'test/**/*.png', @@ -71,6 +70,18 @@ reportSlowerThan: 500, preprocessors : { + 'test/unit/{bin,src}/**/*.js': ['browserify'] + }, + + // browserify configuration + browserify: { + debug: true, + transform: ['brfs'], + configure: function(bundle) { + bundle.on('prebundle', function() { + bundle.external('pixi.js'); + }); + } } }); }; diff --git a/package.json b/package.json index 715de0b..0aa9a31 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "resource-loader": "^1.3.0" }, "devDependencies": { - "browserify": "^8.0.2", - "chai": "^1.10.0", + "browserify": "^9.0.3", "del": "^1.1.0", "gulp": "^3.8.10", "gulp-cached": "^1.0.1", @@ -45,6 +44,8 @@ "jsdoc": "^3.3.0-alpha13", "jshint-summary": "^0.4.0", "karma": "^0.12.28", + "karma-browserify": "^4.0.0", + "karma-chai": "^0.1.0", "karma-firefox-launcher": "^0.1.0", "karma-mocha": "^0.1.10", "karma-spec-reporter": "^0.0.16", diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js index 11fc62b..8ffd74e 100644 --- a/gulp/util/karma.conf.js +++ b/gulp/util/karma.conf.js @@ -5,14 +5,13 @@ // base path, that will be used to resolve files and exclude basePath: path.join(__dirname, '..', '..'), - frameworks: ['mocha'], + frameworks: ['browserify', 'mocha', 'chai'], // list of files / patterns to load in the browser files: [ - 'node_modules/chai/chai.js', 'bin/pixi.js', 'test/lib/**/*.js', - 'test/unit/**/*.js', + 'test/unit/{bin,src}/**/*.js', // 'test/functional/**/*.js', { pattern: 'test/**/*.png', @@ -71,6 +70,18 @@ reportSlowerThan: 500, preprocessors : { + 'test/unit/{bin,src}/**/*.js': ['browserify'] + }, + + // browserify configuration + browserify: { + debug: true, + transform: ['brfs'], + configure: function(bundle) { + bundle.on('prebundle', function() { + bundle.external('pixi.js'); + }); + } } }); }; diff --git a/package.json b/package.json index 715de0b..0aa9a31 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "resource-loader": "^1.3.0" }, "devDependencies": { - "browserify": "^8.0.2", - "chai": "^1.10.0", + "browserify": "^9.0.3", "del": "^1.1.0", "gulp": "^3.8.10", "gulp-cached": "^1.0.1", @@ -45,6 +44,8 @@ "jsdoc": "^3.3.0-alpha13", "jshint-summary": "^0.4.0", "karma": "^0.12.28", + "karma-browserify": "^4.0.0", + "karma-chai": "^0.1.0", "karma-firefox-launcher": "^0.1.0", "karma-mocha": "^0.1.10", "karma-spec-reporter": "^0.0.16", diff --git a/test/unit/bin/pixi.js b/test/unit/bin/pixi.js new file mode 100644 index 0000000..538eeba --- /dev/null +++ b/test/unit/bin/pixi.js @@ -0,0 +1,20 @@ +describe('bin/pixi.js', function () { + 'use strict'; + + var expect = chai.expect; + + it('Standalone PIXI exists', function () { + expect(PIXI). + to.be.an('object'); + }); + + // TODO: This does not actually work with + // Browserify standalone option is use. + // This options wraps bundle in a closure + // and prevents the require function and + // hence the pixi.js module from being exposed. + // it('Module exists', function () { + // expect(require('pixi.js')). + // to.be.an('object'); + // }); +}); diff --git a/gulp/util/karma.conf.js b/gulp/util/karma.conf.js index 11fc62b..8ffd74e 100644 --- a/gulp/util/karma.conf.js +++ b/gulp/util/karma.conf.js @@ -5,14 +5,13 @@ // base path, that will be used to resolve files and exclude basePath: path.join(__dirname, '..', '..'), - frameworks: ['mocha'], + frameworks: ['browserify', 'mocha', 'chai'], // list of files / patterns to load in the browser files: [ - 'node_modules/chai/chai.js', 'bin/pixi.js', 'test/lib/**/*.js', - 'test/unit/**/*.js', + 'test/unit/{bin,src}/**/*.js', // 'test/functional/**/*.js', { pattern: 'test/**/*.png', @@ -71,6 +70,18 @@ reportSlowerThan: 500, preprocessors : { + 'test/unit/{bin,src}/**/*.js': ['browserify'] + }, + + // browserify configuration + browserify: { + debug: true, + transform: ['brfs'], + configure: function(bundle) { + bundle.on('prebundle', function() { + bundle.external('pixi.js'); + }); + } } }); }; diff --git a/package.json b/package.json index 715de0b..0aa9a31 100644 --- a/package.json +++ b/package.json @@ -27,8 +27,7 @@ "resource-loader": "^1.3.0" }, "devDependencies": { - "browserify": "^8.0.2", - "chai": "^1.10.0", + "browserify": "^9.0.3", "del": "^1.1.0", "gulp": "^3.8.10", "gulp-cached": "^1.0.1", @@ -45,6 +44,8 @@ "jsdoc": "^3.3.0-alpha13", "jshint-summary": "^0.4.0", "karma": "^0.12.28", + "karma-browserify": "^4.0.0", + "karma-chai": "^0.1.0", "karma-firefox-launcher": "^0.1.0", "karma-mocha": "^0.1.10", "karma-spec-reporter": "^0.0.16", diff --git a/test/unit/bin/pixi.js b/test/unit/bin/pixi.js new file mode 100644 index 0000000..538eeba --- /dev/null +++ b/test/unit/bin/pixi.js @@ -0,0 +1,20 @@ +describe('bin/pixi.js', function () { + 'use strict'; + + var expect = chai.expect; + + it('Standalone PIXI exists', function () { + expect(PIXI). + to.be.an('object'); + }); + + // TODO: This does not actually work with + // Browserify standalone option is use. + // This options wraps bundle in a closure + // and prevents the require function and + // hence the pixi.js module from being exposed. + // it('Module exists', function () { + // expect(require('pixi.js')). + // to.be.an('object'); + // }); +}); diff --git a/test/unit/src/index.js b/test/unit/src/index.js new file mode 100644 index 0000000..08f4362 --- /dev/null +++ b/test/unit/src/index.js @@ -0,0 +1,11 @@ +describe('src', function () { + 'use strict'; + + var expect = chai.expect; + var pixi = require('../../../src'); + + it('Module exists', function () { + expect(pixi) + .to.be.an('object'); + }); +});