Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow addons to inject middleware into testem #2128

Merged
merged 1 commit into from
Oct 6, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/tasks/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,24 @@ module.exports = Task.extend({
}.bind(this));
},

addonMiddlewares: function() {
this.project.initializeAddons();

return this.project.addons.reduce(function(addons, addon) {
if (addon.testemMiddleware) {
addons.push(addon.testemMiddleware.bind(addon));
}

return addons;
}, []);
},

run: function(options) {
var testemOptions = {
file: options.configFile,
port: options.port,
cwd: options.outputPath
cwd: options.outputPath,
middleware: this.addonMiddlewares()
};

return this.invokeTestem(testemOptions);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"semver": "^3.0.1",
"symlink-or-copy": "^1.0.0",
"temp": "0.8.1",
"testem": "0.6.19",
"testem": "0.6.22",
"through": "^2.3.4",
"tiny-lr": "0.1.4",
"walk-sync": "0.1.3",
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/tasks/test-test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
'use strict';

var assert = require('../../helpers/assert');
var TestTask = require('../../../lib/tasks/test');
var assert = require('../../helpers/assert');
var TestTask = require('../../../lib/tasks/test');
var MockProject = require('../../helpers/mock-project');

describe('test', function() {
var subject;

it('transforms the options and invokes testem properly', function() {
subject = new TestTask({
project: new MockProject(),
invokeTestem: function(options) {
assert.equal(options.file, 'blahzorz.conf');
assert.equal(options.port, 123324);
Expand Down