Skip to content

Commit

Permalink
Upgrade and fix karma
Browse files Browse the repository at this point in the history
  • Loading branch information
meltingice committed Nov 13, 2013
1 parent f132455 commit 0e518b0
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 105 deletions.
165 changes: 72 additions & 93 deletions karma.conf.js
@@ -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
});
};
13 changes: 10 additions & 3 deletions package.json
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions test/ext/grey.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/unit/context.coffee
Expand Up @@ -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)"
Expand Down
11 changes: 6 additions & 5 deletions test/unit/initialization.coffee
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions test/unit/layers.coffee
Expand Up @@ -5,7 +5,7 @@ if exports?

describe "Layers", ->
it "can be created", (done) ->
Caman greyPath, ->
Caman greyImage, ->
@newLayer ->
assert.isObject @c
assert.isObject @options
Expand All @@ -16,7 +16,7 @@ describe "Layers", ->
done()

it "have the correct defaults", (done) ->
Caman greyPath, ->
Caman greyImage, ->
@newLayer ->
assert.deepEqual @options,
blendingMode: 'normal'
Expand All @@ -31,7 +31,7 @@ describe "Layers", ->
done()

it "properly applies to the parent layer", (done) ->
Caman greyPath, ->
Caman greyImage, ->
@newLayer ->
@setBlendingMode 'normal'
@opacity 100
Expand Down

0 comments on commit 0e518b0

Please sign in to comment.