Permalink
Browse files

Upgrade and fix karma

  • Loading branch information...
1 parent f132455 commit 0e518b00b8c014a8aefcef2e19c1b8fa929934b0 @meltingice committed Nov 13, 2013
Showing with 93 additions and 105 deletions.
  1. +72 −93 karma.conf.js
  2. +10 −3 package.json
  3. +1 −0 test/ext/grey.js
  4. +1 −1 test/unit/context.coffee
  5. +6 −5 test/unit/initialization.coffee
  6. +3 −3 test/unit/layers.coffee
View
@@ -1,94 +1,73 @@
-// Sample Testacular configuration file, that contain pretty much all the available options
-// It's used for running client tests on Travis (http://travis-ci.org/#!/vojtajina/testacular)
-// Most of the options can be overriden by cli arguments (see testacular --help)
-//
-// For all available config options and default values, see:
-// https://github.com/vojtajina/testacular/blob/stable/lib/config.js#L54
-
-
-// base path, that will be used to resolve files and exclude
-basePath = '.';
-
-frameworks = ['jasmine'];
-
-// list of files / patterns to load in the browser
-files = [
- JASMINE,
- JASMINE_ADAPTER,
- 'node_modules/chai/chai.js',
- 'test/ext/test-loader.js',
- 'test/ext/grey.js',
- 'dist/caman.full.js',
- 'test/unit/*.coffee'
-];
-
-// list of files to exclude
-exclude = [];
-
-// use dots reporter, as travis terminal does not support escaping sequences
-// possible values: 'dots', 'progress', 'junit', 'teamcity'
-// CLI --reporters progress
-reporters = ['progress'];
-
-// web server port
-// CLI --port 9876
-port = 9876;
-
-// cli runner port
-// CLI --runner-port 9100
-runnerPort = 9100;
-
-// enable / disable colors in the output (reporters and logs)
-// CLI --colors --no-colors
-colors = true;
-
-// level of logging
-// possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
-// CLI --log-level debug
-logLevel = LOG_INFO;
-
-// enable / disable watching file and executing tests whenever any file changes
-// CLI --auto-watch --no-auto-watch
-autoWatch = true;
-
-// Start these browsers, currently available:
-// - Chrome
-// - ChromeCanary
-// - Firefox
-// - Opera
-// - Safari (only Mac)
-// - PhantomJS
-// - IE (only Windows)
-// CLI --browsers Chrome,Firefox,Safari
-browsers = ['Firefox'];
-
-if (!process.env.TRAVISCI) {
- browsers.push('Chrome')
-
- if (require('os').platform() === 'darwin') {
- browsers.push('Safari')
- }
-}
-
-// If browser does not capture in given timeout [ms], kill it
-// CLI --capture-timeout 5000
-captureTimeout = 5000;
-
-// Auto run tests on start (when browsers are captured) and exit
-// CLI --single-run --no-single-run
-singleRun = false;
-
-// report which specs are slower than 500ms
-// CLI --report-slower-than 500
-reportSlowerThan = 500;
-
-// compile coffee scripts
-preprocessors = {
- '**/*.coffee': 'coffee'
-};
+// Karma configuration
+// Generated on Tue Nov 12 2013 23:31:59 GMT-0500 (EST)
+
+module.exports = function(config) {
+ config.set({
+
+ // base path, that will be used to resolve files and exclude
+ basePath: '',
+
+
+ // frameworks to use
+ frameworks: ['mocha'],
+
+
+ // list of files / patterns to load in the browser
+ files: [
+ 'node_modules/chai/chai.js',
+ 'test/ext/test-loader.js',
+ 'test/ext/grey.js',
+ 'dist/caman.full.js',
+ 'test/unit/*.coffee',
+ {pattern: 'test/ext/grey.png', watched: false, included: false}
+ ],
+
+
+ // list of files to exclude
+ exclude: [
+
+ ],
+
+
+ // test results reporter to use
+ // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
+ reporters: ['progress'],
+
+
+ // web server port
+ port: 9876,
-plugins = [
- 'testacular-jasmine',
- 'testacular-chrome-launcher',
- 'testacular-firefox-launcher'
-];
+
+ // enable / disable colors in the output (reporters and logs)
+ colors: true,
+
+
+ // level of logging
+ // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
+ logLevel: config.LOG_INFO,
+
+
+ // enable / disable watching file and executing tests whenever any file changes
+ autoWatch: false,
+
+
+ // Start these browsers, currently available:
+ // - Chrome
+ // - ChromeCanary
+ // - Firefox
+ // - Opera (has to be installed with `npm install karma-opera-launcher`)
+ // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
+ // - PhantomJS
+ // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
+ browsers: ['Chrome', 'Firefox'],
+
+
+ // If browser does not capture in given timeout [ms], kill it
+ captureTimeout: 60000,
+
+
+ // Continuous Integration mode
+ // if true, it capture browsers, run tests and exit
+ singleRun: true
+ });
+};
View
@@ -2,7 +2,14 @@
"name": "caman",
"version": "4.1.2",
"description": "Javascript (Ca)nvas (Man)ipulation for NodeJS and the browser",
- "keywords": ["canvas", "image", "manipulate", "filter", "image manipulation", "editing"],
+ "keywords": [
+ "canvas",
+ "image",
+ "manipulate",
+ "filter",
+ "image manipulation",
+ "editing"
+ ],
"homepage": "http://camanjs.com",
"author": {
"name": "Ryan LeFevre",
@@ -49,12 +56,12 @@
"codo": "*",
"jsmin": "*",
"packer": "*",
- "mocha": "*",
"chai": "*",
"servedir": "*",
"cli": "*",
"cli-table": "*",
- "karma": "*"
+ "karma": "*",
+ "karma-mocha": "*"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha --compilers coffee:coffee-script --reporter spec --globals Caman ./test/unit/*.coffee && ./node_modules/.bin/karma start --single-run",
View
@@ -8,6 +8,7 @@ if (typeof exports !== "undefined" && exports !== null) {
Root.greyImage = new Buffer(Root.greyPixel, 'base64');
} else {
Root = window;
+ Root.greyPath = "/base/test/ext/grey.png";
Root.greyPixel = "data:image/png;base64," + greyPixel;
Root.greyImage = document.createElement('img');
Root.greyImage.src = Root.greyPixel;
@@ -7,7 +7,7 @@ if exports?
describe "Context", ->
it "can be updated after external changes", (done) ->
- caman = Caman greyPath, ->
+ caman = Caman greyImage, ->
canvas = caman.canvas
context = canvas.getContext('2d')
context.fillStyle = "rgba(255, 0, 0, 1)"
@@ -9,31 +9,32 @@ describe "Initialization", ->
describe "with a single argument", ->
it "accepts a file path as a string", ->
+ return unless exports?
assert.doesNotThrow -> Caman(greyPath)
- it "accepts a file/buffer object", ->
+ it "accepts a file/buffer/image object", ->
assert.doesNotThrow -> Caman(greyImage)
it "returns a Caman object", ->
- caman = Caman(greyPath)
+ caman = Caman(greyImage)
assert.isObject caman
assert.isFunction caman.render
assert.instanceOf caman, Caman
describe "with two arguments", ->
it "accepts a file path and a callback", ->
assert.doesNotThrow ->
- Caman greyPath, ->
+ Caman greyImage, ->
it "accepts a file/buffer object and a callback", ->
assert.doesNotThrow ->
Caman greyImage, ->
it "fires the callback when ready", (done) ->
- Caman greyPath, -> done()
+ Caman greyImage, -> done()
it "correctly reads the image data", (done) ->
- Caman greyPath, ->
+ Caman greyImage, ->
assert.lengthOf @pixelData, 4
[r, g, b, a] = @pixelData
@@ -5,7 +5,7 @@ if exports?
describe "Layers", ->
it "can be created", (done) ->
- Caman greyPath, ->
+ Caman greyImage, ->
@newLayer ->
assert.isObject @c
assert.isObject @options
@@ -16,7 +16,7 @@ describe "Layers", ->
done()
it "have the correct defaults", (done) ->
- Caman greyPath, ->
+ Caman greyImage, ->
@newLayer ->
assert.deepEqual @options,
blendingMode: 'normal'
@@ -31,7 +31,7 @@ describe "Layers", ->
done()
it "properly applies to the parent layer", (done) ->
- Caman greyPath, ->
+ Caman greyImage, ->
@newLayer ->
@setBlendingMode 'normal'
@opacity 100

0 comments on commit 0e518b0

Please sign in to comment.