Skip to content

Commit

Permalink
Update all the dependencies, fix the index.js madness
Browse files Browse the repository at this point in the history
Fixes #15, #19, #20, #21
  • Loading branch information
kevicency committed Sep 14, 2015
1 parent 6e35a59 commit 77b296f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 37 deletions.
49 changes: 18 additions & 31 deletions index.js
Expand Up @@ -12,44 +12,31 @@ var endsWith = function(substr) {
};

var framework = function(files) {
files.unshift(pattern(path.resolve(require.resolve('sinon-chai'))));

var sinonPath = path.resolve(require.resolve('sinon'), '../sinon.js');
if (!_(files).map('pattern').find(endsWith(path.relative(__dirname, sinonPath)))) {
var sinonBasePath = path.dirname(sinonPath);
var sinonFiles = [
"./sinon.js",
"./sinon/util/core.js",
"./sinon/extend.js",
"./sinon/typeOf.js",
"./sinon/times_in_words.js",
"./sinon/spy.js",
"./sinon/call.js",
"./sinon/behavior.js",
"./sinon/stub.js",
"./sinon/mock.js",
"./sinon/collection.js",
"./sinon/assert.js",
"./sinon/sandbox.js",
"./sinon/test.js",
"./sinon/test_case.js",
"./sinon/match.js",
"./sinon/format.js",
"./sinon/log_error.js"
];

_.forEach(sinonFiles.reverse(), function(relativeFile) {
var absoluteFile = path.join(sinonBasePath, relativeFile);
var isDuplicate = function(file) {
return !!_(files).map('pattern').find(endsWith(path.relative(__dirname, file)));
}

files.unshift(pattern(absoluteFile));
});
/* Sinon */
var sinonRoot = path.resolve(require.resolve('sinon'), '../../')
var sinonPath = path.resolve(sinonRoot, 'pkg/sinon.js');
var sinonTimersPath = path.resolve(sinonRoot, 'pkg/sinon-timers.js');
if (!isDuplicate(sinonPath)) {
files.unshift(pattern(sinonTimersPath));
files.unshift(pattern(sinonPath));
}

/* Chai */
var chaiPath = path.resolve(require.resolve('chai'), '../chai.js');
if (!_(files).map('pattern').find(endsWith(path.relative(__dirname, chaiPath)))) {
if (!isDuplicate(chaiPath)) {
files.unshift(pattern(chaiPath));
files.push(pattern(path.join(__dirname, 'chai-adapter.js')));
}

/* Sinon-Chai */
var sinonChaiPath = path.resolve(require.resolve('sinon-chai'));
if (!isDuplicate(sinonChaiPath)) {
files.push(pattern(sinonChaiPath))
}
};

framework.$inject = ['config.files'];
Expand Down
11 changes: 5 additions & 6 deletions package.json
Expand Up @@ -25,11 +25,10 @@
"Tobias Kopelke <nox@raynode.de>"
],
"dependencies": {
"chai": "~3.0",
"sinon": "~1.15",
"sinon-chai": "~2.8",
"lodash": "^3.10.1"
"chai": "^3.2.0",
"lodash": "^3.10.1",
"sinon": "^1.16.0",
"sinon-chai": "^2.8.0"
},
"devDependencies": {
}
"devDependencies": {}
}

0 comments on commit 77b296f

Please sign in to comment.