buster-configuration
Advanced tools
Comparing version 0.5.4 to 0.7.0
@@ -1,3 +0,2 @@ | ||
var B = require("buster-core"); | ||
var bcGroup = require("./group"); | ||
var cgroup = require("./group"); | ||
var when = require("when"); | ||
@@ -20,3 +19,3 @@ var path = require("path"); | ||
function safeRequire(fileName, rootPath) { | ||
var mod = path.resolve(rootPath, fileName); | ||
var mod = path.resolve(rootPath || "", fileName || ""); | ||
try { | ||
@@ -31,11 +30,9 @@ return require(mod); | ||
module.exports = { | ||
create: function () { | ||
return B.extend(B.create(this), { | ||
groups: [], | ||
listeners: {}, | ||
sources: [] | ||
}); | ||
}, | ||
function Configuration() { | ||
this.groups = []; | ||
this.listeners = {}; | ||
this.sources = []; | ||
} | ||
Configuration.prototype = { | ||
addGroup: function (name, group, rootPath) { | ||
@@ -46,3 +43,3 @@ var ext = "extends"; // Tricking JsLint :( | ||
} else { | ||
group = bcGroup.create(group, rootPath); | ||
group = cgroup.create(group, rootPath); | ||
} | ||
@@ -72,7 +69,8 @@ | ||
filterEnv: function (env) { | ||
if (!!env && typeof env === "string") { | ||
this.groups = this.groups.filter(function (group) { | ||
this.groups = this.groups.filter(function (group) { | ||
if (!!env && typeof env === "string") { | ||
return group.environment === env; | ||
}); | ||
} | ||
} | ||
return group.environment; | ||
}); | ||
return this; | ||
@@ -98,2 +96,12 @@ }, | ||
B.defineVersionGetter(module.exports, __dirname); | ||
module.exports = { | ||
createConfiguration: function () { | ||
return new Configuration(); | ||
}, | ||
loadConfigurationFile: function (file) { | ||
var config = new Configuration(); | ||
config.loadFile(file); | ||
return config; | ||
} | ||
}; |
@@ -1,5 +0,4 @@ | ||
var B = require("buster-core"); | ||
var Path = require("path"); | ||
var fs = require("fs"); | ||
var A = require("async"); | ||
var async = require("async"); | ||
var glob = require("glob"); | ||
@@ -46,8 +45,8 @@ | ||
module.exports = { | ||
create: function (config, baseName, defaultLocations) { | ||
return B.extend(B.create(this), { | ||
config: config, | ||
baseName: baseName, | ||
defaultLocations: defaultLocations || ["./", "./test/", "./spec/"] | ||
}); | ||
create: function (config, baseName, defaultLocs) { | ||
var loader = Object.create(this); | ||
loader.config = config; | ||
loader.baseName = baseName; | ||
loader.defaultLocations = defaultLocs || ["./", "./test/", "./spec/"]; | ||
return loader; | ||
}, | ||
@@ -99,4 +98,4 @@ | ||
if (typeof fileNames === "string") { fileNames = fileNames.split(","); } | ||
A.reduce(fileNames, this.config, reducer, callback); | ||
async.reduce(fileNames, this.config, reducer, callback); | ||
} | ||
}; |
@@ -1,9 +0,10 @@ | ||
var B = require("buster-core"); | ||
var when = require("when"); | ||
var Path = require("path"); | ||
var url = require("url"); | ||
var fs = require("fs"); | ||
var crypto = require("crypto"); | ||
var url = require("url"); | ||
var _ = require("lodash"); | ||
var when = require("when"); | ||
var async = require("async"); | ||
var bane = require("bane"); | ||
var rr = require("ramp-resources"); | ||
var addUnique = require("./util").addUnique; | ||
@@ -16,11 +17,19 @@ var CONFIG_OPTIONS = ["autoRun"]; | ||
["resources", "environment", "rootPath", "extends", "env", | ||
"server", "options", "serverString", "name", "autoRun", "extensions"] | ||
"server", "options", "serverString", "name", "autoRun", "extensions"] | ||
); | ||
var UNKNOWN_OPTION_HELP = { | ||
"load": "Did you mean one of: deps, libs, src, sources, testHelpers, tests, " + | ||
"specHelpers, specs?", | ||
"load": "Did you mean one of: deps, libs, src, sources, testHelpers, " + | ||
"tests, specHelpers, specs?", | ||
"extend": "Did you mean extends?" | ||
}; | ||
function addUnique(arr1, arr2) { | ||
arr1 = arr1 || []; | ||
(arr2 || []).forEach(function (item) { | ||
if (arr1.indexOf(item) < 0) { arr1.push(item); } | ||
}); | ||
return arr1; | ||
} | ||
function extractResources(o) { | ||
@@ -75,4 +84,4 @@ return { | ||
help = UNKNOWN_OPTION_HELP[prop]; | ||
return "Unknown configuration option '" + prop + "'" + | ||
(help ? "\n" + help : ""); | ||
return new Error("Unknown configuration option '" + prop + "'" + | ||
(help ? "\n" + help : "")); | ||
} | ||
@@ -91,3 +100,3 @@ } | ||
var opt = {}, key, i, l; | ||
opt.resources = B.extend(group.resources, options.resources); | ||
opt.resources = _.extend(group.resources, options.resources); | ||
@@ -99,3 +108,3 @@ for (i = 0, l = LOAD_ALIASES.length; i < l; ++i) { | ||
return B.extend(group.config, opt, { | ||
return _.extend(group.config, opt, { | ||
environment: group.environment, | ||
@@ -131,3 +140,3 @@ rootPath: group.rootPath, | ||
group.emit("load:" + section, rs); | ||
rs.then(B.partial(done, null, rs), done); | ||
rs.then(function () { done(null, rs); }, done); | ||
}, function (err) { | ||
@@ -139,7 +148,7 @@ done(err); | ||
function buildResourceSet(group, done) { | ||
var rs = rr.resourceSet.create(group.rootPath); | ||
var frameworkResources = rr.resourceSet.create("/"); | ||
var rs = rr.createResourceSet(group.rootPath); | ||
var frameworkResources = rr.createResourceSet("/"); | ||
rs.addResources(group.resources).then(function () { | ||
B.parallel([ | ||
async.parallel([ | ||
function (next) { | ||
@@ -149,6 +158,6 @@ group.emit("load:framework", frameworkResources); | ||
}, | ||
B.partial(resourceSetFor, rs.concat(), group, "libs"), | ||
B.partial(resourceSetFor, rs.concat(), group, "sources"), | ||
B.partial(resourceSetFor, rs.concat(), group, "testHelpers"), | ||
B.partial(resourceSetFor, rs.concat(), group, "tests") | ||
resourceSetFor.bind(null, rs.concat(), group, "libs"), | ||
resourceSetFor.bind(null, rs.concat(), group, "sources"), | ||
resourceSetFor.bind(null, rs.concat(), group, "testHelpers"), | ||
resourceSetFor.bind(null, rs.concat(), group, "tests") | ||
], function (err, results) { | ||
@@ -159,3 +168,3 @@ if (err) { return done(err); } | ||
group.emit("load:resources", resourceSet); | ||
resourceSet.then(B.partial(done, null), done); | ||
resourceSet.then(done.bind(null, null), done); | ||
}, done); | ||
@@ -169,10 +178,10 @@ }, done); | ||
var cg = module.exports = B.extend(B.eventEmitter.create(), { | ||
var cg = module.exports = _.extend(bane.createEventEmitter(), { | ||
create: function (options, rootPath) { | ||
options = options || {}; | ||
return B.extend(Object.create(this), { | ||
config: B.extend({}, options), | ||
return _.extend(Object.create(this), { | ||
config: _.extend({}, options), | ||
rootPath: Path.resolve(rootPath || "", options.rootPath || ""), | ||
server: extractServer(options), | ||
environment: options.environment || options.env || "browser", | ||
environment: options.environment || options.env, | ||
options: extractOptions(options), | ||
@@ -179,0 +188,0 @@ serverString: options.server, |
{ | ||
"name": "buster-configuration", | ||
"version": "0.5.4", | ||
"description": "Implements the buster.js configuration file, including resource loading, file globbing, grouped test configs and more", | ||
"homepage": "http://busterjs.org/buster-configuration", | ||
"author": { | ||
"name": "Christian Johansen", | ||
"email": "christian@cjohansen.no", | ||
"url": "http://cjohansen.no" | ||
}, | ||
"contributors": [ | ||
{ | ||
"name": "August Lilleaas", | ||
"email": "august.lilleaas@gmail.com", | ||
"url": "http://augustl.com" | ||
"name": "buster-configuration", | ||
"version": "0.7.0", | ||
"description": "Groks the buster.js configuration file, including resource loading, file globbing, grouped test configs and more", | ||
"homepage": "http://busterjs.org/buster-configuration", | ||
"author": { | ||
"name": "Christian Johansen", | ||
"email": "christian@cjohansen.no", | ||
"url": "http://cjohansen.no" | ||
}, | ||
"contributors": [{ | ||
"name": "August Lilleaas", | ||
"email": "august.lilleaas@gmail.com", | ||
"url": "http://augustl.com" | ||
}, { | ||
"name": "Daniel Wittner", | ||
"email": "d.wittner@gmx.de", | ||
"url": "https://github.com/dwittner" | ||
}, { | ||
"name": "Elliot Winkler", | ||
"email": "elliot.winkler@gmail.com" | ||
}, { | ||
"name": "Sam Riley", | ||
"email": "samriley@hotmail.co.uk" | ||
}, { | ||
"name": "Stein Magnus Jodal", | ||
"email": "stein.magnus@jodal.no", | ||
"url": "http://jodal.no" | ||
}], | ||
"main": "./lib/buster-configuration", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/busterjs/buster-configuration.git" | ||
}, | ||
"scripts": { | ||
"test": "node run-tests.js" | ||
}, | ||
"dependencies": { | ||
"lodash": "~1.0", | ||
"when": "https://github.com/cujojs/when/tarball/1.3.0", | ||
"async": "~0.1", | ||
"ramp-resources": "~1.0", | ||
"glob": "~3.1", | ||
"bane": "~1.0" | ||
}, | ||
"devDependencies": { | ||
"buster-node": "0.1", | ||
"rimraf": "~1" | ||
} | ||
], | ||
"main": "./lib/buster-configuration", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://gitorious.org/buster/buster-configuration.git" | ||
}, | ||
"scripts": { | ||
"test": "./node_modules/buster/bin/buster-test" | ||
}, | ||
"dependencies": { | ||
"buster-core": "=0.6.4", | ||
"when": "https://github.com/cujojs/when/tarball/1.3.0", | ||
"ramp-resources": "=0.4.2", | ||
"buster-evented-logger": "=0.4.5", | ||
"async": "~0.1", | ||
"glob": "~3.1" | ||
}, | ||
"devDependencies": { | ||
"buster": "*", | ||
"rimraf": "~1" | ||
}, | ||
"readme": "# buster-configuration\n\n[![Build status](https://secure.travis-ci.org/busterjs/buster-configuration.png?branch=master)](http://travis-ci.org/busterjs/buster-configuration)\n\nLoad and interact with Buster.JS configuration files\n", | ||
"readmeFilename": "Readme.md", | ||
"_id": "buster-configuration@0.5.3", | ||
"_from": "buster-configuration@=0.5.3" | ||
} |
@@ -1,7 +0,11 @@ | ||
var buster = require("buster"); | ||
var busterConfiguration = require("../lib/buster-configuration"); | ||
var buster = require("buster-node"); | ||
var assert = buster.assert; | ||
var bc = require("../lib/buster-configuration"); | ||
var helper = require("./test-helper"); | ||
var events = require("events"); | ||
buster.testCase("buster-configuration", { | ||
setUp: function () { | ||
this.c = busterConfiguration.create(); | ||
helper.cdFixtures(); | ||
this.c = bc.createConfiguration(); | ||
this.rootPath = __dirname; | ||
@@ -43,2 +47,7 @@ }, | ||
"loads config from config file": function () { | ||
var config = bc.loadConfigurationFile(__dirname + "/../buster"); | ||
assert.equals(config.groups.length, 1); | ||
}, | ||
"uses explicit file name": function () { | ||
@@ -89,2 +98,12 @@ this.c.loadFile(__dirname + "/fixtures/dups/file.js"); | ||
assert.equals(this.c.groups.length, 2); | ||
}, | ||
"filters groups without environment": function () { | ||
this.c.addGroup("My group 1", this.node, this.rootPath); | ||
this.c.addGroup("My group 2", {}, this.rootPath); | ||
this.c.addGroup("My group 3", this.browser, this.rootPath); | ||
this.c.filterEnv(); | ||
assert.equals(this.c.groups.length, 2); | ||
} | ||
@@ -110,4 +129,4 @@ }, | ||
"delegates to groups": function () { | ||
this.c.groups = [buster.eventEmitter.create(), | ||
buster.eventEmitter.create()]; | ||
this.c.groups = [new events.EventEmitter(), | ||
new events.EventEmitter()]; | ||
@@ -136,4 +155,4 @@ var listener = this.spy(); | ||
"delegates to groups": function () { | ||
this.c.groups = [buster.eventEmitter.create(), | ||
buster.eventEmitter.create()]; | ||
this.c.groups = [new events.EventEmitter(), | ||
new events.EventEmitter()]; | ||
@@ -140,0 +159,0 @@ var listener = this.spy(); |
@@ -1,4 +0,6 @@ | ||
var path = require('path'); | ||
var buster = require("buster"); | ||
var configuration = require("../lib/buster-configuration"); | ||
var path = require("path"); | ||
var buster = require("buster-node"); | ||
var assert = buster.assert; | ||
var refute = buster.refute; | ||
var bc = require("../lib/buster-configuration"); | ||
var fileLoader = require("../lib/file-loader"); | ||
@@ -10,3 +12,3 @@ var helper = require("./test-helper"); | ||
helper.cdFixtures(); | ||
this.loader = fileLoader.create(configuration.create(), "seaman"); | ||
this.loader = fileLoader.create(bc.createConfiguration(), "seaman"); | ||
}, | ||
@@ -32,3 +34,3 @@ | ||
this.loader.load("", done(function (err, config) { | ||
buster.log(err, config); | ||
console.log(err, config, "\n"); | ||
assert.defined(err); | ||
@@ -72,3 +74,4 @@ assert.match(err.message, | ||
"loads multiple configuration files": function (done) { | ||
this.loader.load(["seaman.js", "seaman2.js"], done(function (err, config) { | ||
var files = ["seaman.js", "seaman2.js"]; | ||
this.loader.load(files, done(function (err, config) { | ||
assert.equals(config.groups.length, 4); | ||
@@ -75,0 +78,0 @@ })); |
@@ -1,8 +0,15 @@ | ||
var buster = require("buster"); | ||
var buster = require("buster-node"); | ||
var assert = buster.assert; | ||
var refute = buster.refute; | ||
var bcGroup = require("../lib/group"); | ||
var cgroup = require("../lib/group"); | ||
var fs = require("fs"); | ||
var Path = require("path"); | ||
var helper = require("./test-helper"); | ||
function countdown(num, done) { | ||
return function () { | ||
if (--num === 0) { done(); } | ||
}; | ||
} | ||
function assertContainsResources(group, resources, done) { | ||
@@ -39,4 +46,8 @@ group.resolve().then(function (resourceSet) { | ||
buster.testCase("configuration group", { | ||
setUp: function () { | ||
helper.cdFixtures(); | ||
}, | ||
"creates resources with root path": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["foo.js", "bar.js"] | ||
@@ -49,3 +60,3 @@ }, __dirname + "/fixtures"); | ||
"gets file contents as actual content": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["foo.js"] | ||
@@ -62,3 +73,3 @@ }, __dirname + "/fixtures"); | ||
"resolves globs": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["*.js"] | ||
@@ -71,3 +82,3 @@ }, __dirname + "/fixtures"); | ||
"adds resource as object with path": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ path: "foo.js", content: "Ok" }] | ||
@@ -80,3 +91,3 @@ }, __dirname + "/fixtures"); | ||
"respects custom headers": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ | ||
@@ -95,3 +106,3 @@ path: "foo.js", | ||
"fails for file outside root": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["../../*.js"] | ||
@@ -110,3 +121,3 @@ }, __dirname + "/fixtures"); | ||
"adds backend resource": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ path: "foo", backend: "http://10.0.0.1/" }] | ||
@@ -121,3 +132,3 @@ }); | ||
"adds combined resources": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["foo.js", "bar.js", | ||
@@ -132,3 +143,3 @@ { path: "/bundle.js", combine: ["/foo.js", "/bar.js"] }] | ||
"adds resources with content for non-existent file": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ | ||
@@ -144,3 +155,3 @@ path: "/does-not-exist.txt", | ||
"adds resources with content for file that exists": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ path: "/foo.js", content: "Hello, World" }] | ||
@@ -153,3 +164,3 @@ }, __dirname + "/fixtures"); | ||
"loads resource as source": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: ["foo.js"], | ||
@@ -163,7 +174,7 @@ sources: ["foo.js"] | ||
"adds sourcees to load and add them as file resources": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
sources: ["foo.js", "bar.js"] | ||
}, __dirname + "/fixtures"); | ||
var next = buster.countdown(2, done); | ||
var next = countdown(2, done); | ||
assertContainsResources(group, ["/foo.js", "/bar.js"], next); | ||
@@ -174,3 +185,3 @@ assertLoad(group, ["/foo.js", "/bar.js"], next); | ||
"creates group without file system access": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
resources: [{ path: "/hey", content: "// OK" }], | ||
@@ -184,3 +195,3 @@ sources: ["/hey"] | ||
"adds source files via glob pattern": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
sources: ["*.js"] | ||
@@ -193,3 +204,3 @@ }, __dirname + "/fixtures"); | ||
"libs, sources and tests in right order with globbing": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
libs: ["fo*.js"], | ||
@@ -201,3 +212,3 @@ sources: ["b*r.js"], | ||
var paths = ["/foo.js", "/bar.js", "/test/my-testish.js"]; | ||
var callback = buster.countdown(2, done); | ||
var callback = countdown(2, done); | ||
@@ -209,3 +220,3 @@ assertContainsResources(group, paths, callback); | ||
"loads tests and testHelpers in right order": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
testHelpers: ["test/*.js"], | ||
@@ -216,3 +227,3 @@ tests: ["b*r.js"] | ||
var paths = ["/test/my-testish.js", "/bar.js"]; | ||
var callback = buster.countdown(2, done); | ||
var callback = countdown(2, done); | ||
@@ -224,3 +235,3 @@ assertContainsResources(group, paths, callback); | ||
"loads deps, sources and specs in right order": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
deps: ["fo*.js"], | ||
@@ -235,3 +246,3 @@ src: ["b*r.js"], | ||
"loads libs, deps and sources in right order": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
deps: ["fo*.js"], | ||
@@ -246,3 +257,3 @@ libs: ["b*r.js"], | ||
"loads test libs and spec libs in right order": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
specHelpers: ["fo*.js"], | ||
@@ -256,3 +267,3 @@ testHelpers: ["b*r.js"] | ||
"loads libs, src and sources in right order": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
libs: ["ba*.js"], | ||
@@ -268,3 +279,3 @@ src: ["f*.js"], | ||
"is parsed": function () { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
server: "http://localhost:1234/buster" | ||
@@ -281,3 +292,3 @@ }, __dirname + "/fixtures"); | ||
"is parsed without path": function () { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
server: "http://localhost:1234" | ||
@@ -296,13 +307,13 @@ }, __dirname + "/fixtures"); | ||
"is set": function () { | ||
var group = bcGroup.create({ environment: "node" }); | ||
var group = cgroup.create({ environment: "node" }); | ||
assert.equals(group.environment, "node"); | ||
}, | ||
"defaults to browser": function () { | ||
var group = bcGroup.create({}); | ||
assert.equals(group.environment, "browser"); | ||
"defaults to nothing": function () { | ||
var group = cgroup.create({}); | ||
refute.defined(group.environment); | ||
}, | ||
"is set via env shorthand": function () { | ||
var group = bcGroup.create({ env: "node" }); | ||
var group = cgroup.create({ env: "node" }); | ||
assert.equals(group.environment, "node"); | ||
@@ -314,3 +325,3 @@ } | ||
"is set": function () { | ||
var group = bcGroup.create({ autoRun: true }); | ||
var group = cgroup.create({ autoRun: true }); | ||
assert.equals(group.options.autoRun, true); | ||
@@ -320,3 +331,3 @@ }, | ||
"is not set by default": function () { | ||
var group = bcGroup.create({}); | ||
var group = cgroup.create({}); | ||
refute.defined(group.options.autoRun); | ||
@@ -327,3 +338,3 @@ } | ||
"supports duplicate items in sources for ordering": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
sources: ["foo.js", "foo.js", "*.js"] | ||
@@ -337,3 +348,3 @@ }, __dirname + "/fixtures"); | ||
setUp: function () { | ||
this.group = bcGroup.create({}, __dirname + "/fixtures"); | ||
this.group = cgroup.create({}, __dirname + "/fixtures"); | ||
}, | ||
@@ -360,3 +371,3 @@ | ||
"fires when everything is loaded": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
sources: ["foo.js"] | ||
@@ -385,3 +396,3 @@ }, __dirname + "/fixtures"); | ||
"does not resolve multiple times": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
libs: ["foo.js"] | ||
@@ -399,3 +410,3 @@ }, __dirname + "/fixtures"); | ||
"can override dependencies": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
deps: ["foo.js"] | ||
@@ -412,3 +423,3 @@ }, __dirname + "/fixtures"); | ||
"triggers with resolved glob patterns": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
deps: ["*.js"] | ||
@@ -429,3 +440,3 @@ }, __dirname + "/fixtures"); | ||
"fires dependencies only once for libs/deps": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
deps: ["foo.js"], | ||
@@ -446,3 +457,3 @@ libs: ["bar.js"] | ||
"fires sources once for src/sources": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
src: ["foo.js"], | ||
@@ -464,3 +475,3 @@ sources: ["bar.js"] | ||
"fires tests once for specs/tests": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
tests: ["foo.js"], | ||
@@ -482,3 +493,4 @@ specs: ["bar.js"] | ||
setUp: function () { | ||
this.group = bcGroup.create({ | ||
this.group = cgroup.create({ | ||
environment: "browser", | ||
libs: ["foo.js"], | ||
@@ -547,3 +559,3 @@ server: "localhost:9191", | ||
var create = this.stub().returns({}); | ||
var original = bcGroup.create({ | ||
var original = cgroup.create({ | ||
extensions: [{ create: create }] | ||
@@ -561,3 +573,3 @@ }, __dirname + "/fixtures"); | ||
var create = this.stub().returns({}); | ||
var original = bcGroup.create({ | ||
var original = cgroup.create({ | ||
extensions: [{ name: "amd", create: create }], | ||
@@ -613,3 +625,3 @@ amd: { id: 42 } | ||
"loads object extension": function (done) { | ||
var group = bcGroup.create({}); | ||
var group = cgroup.create({}); | ||
group.extensions.push({}); | ||
@@ -623,3 +635,3 @@ | ||
"fails for string extension": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: ["buster-lint"] | ||
@@ -634,3 +646,3 @@ }); | ||
"loads all extensions": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ name: "baluba" }, { name: "swan" }] | ||
@@ -645,3 +657,3 @@ }, __dirname + "/fixtures"); | ||
"calls create on extensions": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [this.module] | ||
@@ -656,3 +668,3 @@ }, __dirname + "/fixtures"); | ||
"fails gracefully if extensions is not array": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: this.module | ||
@@ -669,3 +681,3 @@ }, __dirname + "/fixtures"); | ||
var create = this.stub().returns({}); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ | ||
@@ -684,3 +696,3 @@ name: "duda", | ||
"does not fail if extension has no create method": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{}] | ||
@@ -697,3 +709,3 @@ }, __dirname + "/fixtures"); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ configure: configure }] | ||
@@ -710,3 +722,3 @@ }, __dirname + "/fixtures"); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ myevent: hooks[0] }, { myevent: hooks[1] }] | ||
@@ -722,4 +734,4 @@ }, __dirname + "/fixtures"); | ||
"skips hook on extensions with no corresponding method": function (done) { | ||
var group = bcGroup.create({ | ||
"skips hook on exts with no corresponding method": function (done) { | ||
var group = cgroup.create({ | ||
extensions: [{ myevent: this.spy() }, {}] | ||
@@ -738,3 +750,3 @@ }, __dirname + "/fixtures"); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ myevent: hook }] | ||
@@ -750,3 +762,3 @@ }, __dirname + "/fixtures"); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [{ myevent: hook }] | ||
@@ -772,3 +784,3 @@ }, __dirname + "/fixtures"); | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
extensions: [extension] | ||
@@ -789,3 +801,3 @@ }, __dirname + "/fixtures"); | ||
"cause an error": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
thingie: "Oh noes" | ||
@@ -800,3 +812,3 @@ }); | ||
"include custom message": function (done) { | ||
var group = bcGroup.create({ | ||
var group = cgroup.create({ | ||
load: [""] | ||
@@ -803,0 +815,0 @@ }); |
@@ -1,6 +0,7 @@ | ||
var buster = require("buster"); | ||
var buster = require("buster-node"); | ||
var rmrf = require("rimraf"); | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
var FIXTURES_ROOT = path.resolve(__dirname, "..", ".fixtures"); | ||
var MODULE_ROOT = path.resolve(__dirname, ".."); | ||
var FIXTURES_ROOT = path.resolve(MODULE_ROOT, ".fixtures"); | ||
@@ -19,8 +20,9 @@ module.exports = { | ||
buster.assertions.add(name, { | ||
buster.referee.add(name, { | ||
assert: function (expected) { | ||
return buster.assertions.match(stream.toString(), expected); | ||
return buster.referee.match(stream.toString(), expected); | ||
}, | ||
assertMessage: "${2}Expected " + name + "\n${0}\nto match\n${1}", | ||
refuteMessage: "${2}Expected " + name + "\n${0}\nnot to match\n${1}", | ||
refuteMessage: "${2}Expected " + name + | ||
"\n${0}\nnot to match\n${1}", | ||
values: function (expected, message) { | ||
@@ -55,3 +57,3 @@ return [stream.toString(), expected, message || ""]; | ||
cdFixtures: function () { | ||
this.mkdir(""); | ||
this.mkdir(FIXTURES_ROOT); | ||
process.chdir(FIXTURES_ROOT); | ||
@@ -67,4 +69,5 @@ }, | ||
} | ||
process.chdir(MODULE_ROOT); | ||
rmrf(FIXTURES_ROOT, function (err) { | ||
if (err) { require("buster").log(err.toString()); } | ||
if (err) { console.log(err.toString()); } | ||
done(); | ||
@@ -71,0 +74,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
55685
22
0
1369
17
+ Addedbane@~1.0
+ Addedlodash@~1.0
+ Addedbane@1.0.0(transitive)
+ Addedglob@3.2.11(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlodash@0.5.21.0.2(transitive)
+ Addedlru-cache@1.0.6(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedminimatch@0.1.50.3.0(transitive)
+ Addedramp-resources@1.0.5(transitive)
- Removedbuster-core@=0.6.4
- Removedbuster-evented-logger@=0.4.5
Updatedramp-resources@~1.0