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

proposal for moving to mocha #409

Merged
merged 3 commits into from
Apr 21, 2015
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.project
.tmp_*
node_modules
coverage
3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test
tests
bench
5 changes: 5 additions & 0 deletions bench/chop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var chop = require('../chop');

module.exports = function() {
chop('whitespace', 2);
};
5 changes: 5 additions & 0 deletions bench/count.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var count = require('../count');

module.exports = function() {
count('Hello worls', 'l');
};
5 changes: 5 additions & 0 deletions bench/endsWith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var endsWith = require('../endsWith');

module.exports = function() {
endsWith("foobar", "xx");
};
5 changes: 5 additions & 0 deletions bench/escapeHTML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var escapeHTML = require('../escapeHTML');

module.exports = function() {
escapeHTML('<div>Blah blah blah</div>');
};
5 changes: 5 additions & 0 deletions bench/insert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var insert = require('../insert');

module.exports = function() {
insert('Hello ', 6, 'world');
};
5 changes: 5 additions & 0 deletions bench/isBlank.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var isBlank = require('../isBlank');

module.exports = function() {
isBlank('');
};
5 changes: 5 additions & 0 deletions bench/join.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var join = require('../join');

module.exports = function() {
join('separator', 1, 2, 3, 4, 5, 6, 7, 8, 'foo', 'bar', 'lol', 'wut');
};
8 changes: 8 additions & 0 deletions bench/levenshtein.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var levenshtein = require('../levenshtein');

module.exports = function() {
levenshtein('pineapple', 'potato');
levenshtein('seven', 'eight');
levenshtein('the very same string', 'the very same string');
levenshtein('very very very long string', 'something completely different');
};
26 changes: 26 additions & 0 deletions bench/pad.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
var pad = require('../pad');
var tests = {};

tests['pad default'] = function(){
pad('foo', 12);
};

tests['pad hash left'] = function(){
pad('foo', 12, '#');
};

tests['pad hash right'] = function(){
pad('foo', 12, '#', 'right');
};

tests['pad hash both'] = function(){
pad('foo', 12, '#', 'both');
};

tests['pad hash both longPad'] = function(){
pad('foo', 12, 'f00f00f00', 'both');
};

module.exports = {
tests: tests
};
5 changes: 5 additions & 0 deletions bench/prune.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var prune = require('../prune');

module.exports = function() {
prune('Hello world', 5);
};
5 changes: 5 additions & 0 deletions bench/reverse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var reverse = require('../reverse');

module.exports = function() {
reverse('Hello World');
};
5 changes: 5 additions & 0 deletions bench/slugify.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var slugify = require('../slugify');

module.exports = function() {
slugify("Un éléphant à l'orée du bois");
};
5 changes: 5 additions & 0 deletions bench/splice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var splice = require('../splice');

module.exports = function() {
splice('https://edtsech@bitbucket.org/edtsech/underscore.strings', 30, 7, 'epeli');
};
5 changes: 5 additions & 0 deletions bench/startsWith.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var startsWith = require('../startsWith');

module.exports = function() {
startsWith("foobar", "foo");
};
5 changes: 5 additions & 0 deletions bench/strLeft.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var strLeft = require('../strLeft');

module.exports = function() {
strLeft('aaa_bbb_ccc', '_');
};
5 changes: 5 additions & 0 deletions bench/strLeftBack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var strLeftBack = require('../strLeftBack');

module.exports = function() {
strLeftBack('aaa_bbb_ccc', '_');
};
5 changes: 5 additions & 0 deletions bench/strRight.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var strRight = require('../strRight');

module.exports = function() {
strRight('aaa_bbb_ccc', '_');
};
5 changes: 5 additions & 0 deletions bench/strRightBack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var strRightBack = require('../strRightBack');

module.exports = function() {
strRightBack('aaa_bbb_ccc', '_');
};
12 changes: 12 additions & 0 deletions bench/succ.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var succ = require('../succ');

module.exports = function() {
var letter = 'a', alphabet = [];

for (var i=0; i < 26; i++) {
alphabet.push(letter);
letter = succ(letter);
}

return alphabet;
};
5 changes: 5 additions & 0 deletions bench/titleize.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var titleize = require('../titleize');

module.exports = function() {
titleize('the titleize string method');
};
5 changes: 5 additions & 0 deletions bench/toNumber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var toNumber = require('../toNumber');

module.exports = function() {
toNumber('10.232323', 2);
};
18 changes: 18 additions & 0 deletions bench/trim.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var s = require('../');
var tests = {};

tests['trimNoNative'] = function() {
return s.trim(" foobar ", " ");
};

tests['trim'] = function() {
return s.trim(" foobar ");
};

tests['trim object-oriented'] = function() {
return s(" foobar ").trim().value();
};

module.exports = {
tests: tests
};
5 changes: 5 additions & 0 deletions bench/truncate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var truncate = require('../truncate');

module.exports = function() {
truncate('Hello world', 5);
};
5 changes: 5 additions & 0 deletions bench/unescapeHTML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var unescapeHTML = require('../unescapeHTML');

module.exports = function() {
unescapeHTML('&lt;div&gt;Blah blah blah&lt;/div&gt;');
};
35 changes: 30 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
var gulp = require('gulp-param')(require('gulp'), process.argv),
qunit = require("gulp-qunit"),
mocha = require("gulp-mocha"),
istanbul = require('gulp-istanbul'),
bench = require('gulp-bench'),
uglify = require('gulp-uglify'),
clean = require('gulp-clean'),
bump = require('gulp-bump'),
Expand All @@ -10,13 +12,36 @@ var gulp = require('gulp-param')(require('gulp'), process.argv),
DEST = 'dist',
SRC_COMPILED = 'underscore.string.js',
MIN_FILE = 'underscore.string.min.js',
TEST_SUITES = ['test/test.html', 'test/test_standalone.html', 'test/test_underscore/index.html'],
VERSION_FILES = ['./package.json', './component.json', './bower.json'];
VERSION_FILES_JS = [SRC, 'package.js'];

gulp.task('test', ['browserify'], function() {
return gulp.src(TEST_SUITES)
.pipe(qunit());
gulp.task('test', ['browserify'], function(cov) {
var reporters = ['html'];

if (cov) {
reporters.push('text');
} else {
reporters.push('text-summary');
}

return gulp.src(['*.js', 'helper/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', function () {
return gulp.src(['tests/*.js'])
.pipe(mocha({
ui: 'qunit',
reporter: 'dot'
}))
.pipe(istanbul.writeReports({
reporters: reporters
}));
});
});

gulp.task('bench', ['browserify'], function() {
return gulp.src('bench/*.js')
.pipe(bench());
});

gulp.task('browserify', function() {
Expand Down
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,18 @@
},
"devDependencies": {
"gulp": "^3.8.11",
"gulp-bench": "^1.1.0",
"gulp-browserify": "~0.5.0",
"gulp-bump": "~0.1.11",
"gulp-clean": "~0.3.1",
"gulp-istanbul": "^0.6.0",
"gulp-mocha": "^2.0.0",
"gulp-param": "~0.6.3",
"gulp-qunit": "~1.1.0",
"gulp-rename": "~1.2.0",
"gulp-replace": "~0.5.0",
"gulp-uglify": "~1.0.1"
"gulp-uglify": "~1.0.1",
"mocha": "^2.1.0",
"underscore": "^1.7.0"
},
"jshintConfig": {
"node": true,
Expand All @@ -57,5 +61,6 @@
"globals": {
"s": true
}
}
},
"dependencies": {}
}
45 changes: 0 additions & 45 deletions test/run-qunit.js

This file was deleted.

Loading