-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from zemlanin/master
karma testing
- Loading branch information
Showing
5 changed files
with
103 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
bin = $(shell npm bin) | ||
browserify = $(bin)/browserify | ||
|
||
node_modules = $(shell pwd)/node_modules | ||
karma = $(node_modules)/karma/bin/karma | ||
karma_conf = $(shell pwd)/spec/karma.conf.js | ||
|
||
.PHONY: example test | ||
|
||
example: | ||
$(browserify) examples/app.js -r ./src/main.js:'rocket-launcher' > examples/app.bundle.js | ||
|
||
test: | ||
$(karma) start $(karma_conf) --single-run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module.exports = function(config) { | ||
config.set({ | ||
basePath: '', | ||
|
||
frameworks: ['browserify', 'jasmine'], | ||
|
||
files: [ | ||
'**/*Spec.js' | ||
], | ||
|
||
exclude: [], | ||
|
||
preprocessors: { | ||
'**/*Spec.js': ['browserify'] | ||
}, | ||
|
||
reporters: ['progress'], | ||
|
||
port: 9876, | ||
|
||
colors: true, | ||
|
||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_INFO, | ||
|
||
autoWatch: false, | ||
|
||
browsers: ['PhantomJS'], | ||
|
||
plugins: [ | ||
'karma-browserify', | ||
'karma-jasmine', | ||
'karma-phantomjs-launcher' | ||
], | ||
|
||
browserify: { | ||
plugin: ['proxyquireify/plugin'] | ||
}, | ||
|
||
singleRun: false | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
function appendDiv() { | ||
var node = document.createElement('div'); | ||
node.setAttribute('test-node', ''); | ||
document.body.appendChild(node); | ||
return node; | ||
} | ||
|
||
describe("main", function() { | ||
var launcher = require('../../src/main.js'); | ||
|
||
beforeEach(function() { | ||
}); | ||
|
||
afterEach(function() { | ||
// Array.prototype.forEach.call( | ||
// document.querySelectorAll('[test-node]'), | ||
// function (el) { | ||
// el.remove(); | ||
// } | ||
// ); | ||
}); | ||
|
||
it("should run component function", function(done) { | ||
var node = appendDiv(); | ||
node.setAttribute('data-launcher', 'testComponent'); | ||
|
||
var component = function (element, opts) { | ||
done(); | ||
}; | ||
|
||
launcher({ | ||
'testComponent': component | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"spec_dir": "spec", | ||
"spec_files": [ | ||
"**/*[sS]pec.js" | ||
], | ||
"helpers": [ | ||
"helpers/**/*.js" | ||
] | ||
} |