Skip to content

Commit

Permalink
feat: Remove unused test stub code
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikGartner committed Feb 23, 2019
1 parent 6a207c6 commit 938395a
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 372 deletions.
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

76 changes: 4 additions & 72 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ function createLintTask(taskName, files) {
// Lint our source code
createLintTask('lint-src', ['src/**/*.js']);

// Lint our test code
createLintTask('lint-test', ['test/**/*.js']);

function getPackageJsonVersion () {
// We parse the json file instead of using require because require caches
// multiple calls so the version number won't be updated
Expand Down Expand Up @@ -115,81 +112,16 @@ function bundle(bundler) {
.pipe($.livereload());
}

function getBundler() {
// Our browserify bundle is made up of our unit tests, which
// should individually load up pieces of our application.
// We also include the browserify setup file.
var testFiles = glob.sync('./test/unit/**/*');
var allFiles = ['./test/setup/browserify.js'].concat(testFiles);

// Create our bundler, passing in the arguments required for watchify
var bundler = browserify(allFiles, watchify.args);

// Watch the bundler, and re-bundle it whenever files change
bundler = watchify(bundler);
bundler.on('update', function() {
bundle(bundler);
});

// Set up Babelify so that ES6 works in the tests
bundler.transform(babelify.configure({
sourceMapRelative: __dirname + '/src'
}));

return bundler;
};

// Build the unit test suite for running tests
// in the browser
gulp.task('browserify', function() {
return bundle(getBundler());
});

function test() {
return gulp.src(['test/setup/node.js', 'test/unit/**/*.js'], {read: false})
.pipe($.mocha({reporter: 'dot', globals: config.mochaGlobals}));
}

gulp.task('coverage', ['lint-src', 'lint-test'], function(done) {
require('babel-core/register');
gulp.src(['src/**/*.js'])
.pipe($.istanbul({ instrumenter: isparta.Instrumenter }))
.pipe($.istanbul.hookRequire())
.on('finish', function() {
return test()
.pipe($.istanbul.writeReports())
.on('end', done);
});
});

// Lint and run our tests
gulp.task('test', ['lint-src', 'lint-test'], function() {
require('babel-core/register');
return test();
});

// Ensure that linting occurs before browserify runs. This prevents
// the build from breaking due to poorly formatted code.
gulp.task('build-in-sequence', function(callback) {
runSequence(['lint-src', 'lint-test'], 'browserify', callback);
});

// These are JS files that should be watched by Gulp. When running tests in the browser,
// watchify is used instead, so these aren't included.
const jsWatchFiles = ['src/**/*', 'test/**/*'];
const jsWatchFiles = ['src/**/*'];
// These are files other than JS files which are to be watched. They are always watched.
const otherWatchFiles = ['package.json', '**/.eslintrc', '.jscsrc'];

// Run the headless unit tests as you make changes.
gulp.task('watch', function() {
const watchFiles = jsWatchFiles.concat(otherWatchFiles);
gulp.watch(watchFiles, ['test']);
});

// Set up a livereload environment for our spec runner
gulp.task('test-browser', ['build-in-sequence'], function() {
$.livereload.listen({port: 35729, host: 'localhost', start: true});
return gulp.watch(otherWatchFiles, ['build-in-sequence']);
gulp.watch(watchFiles, ['build']);
});

gulp.task('bump', function() {
Expand Down Expand Up @@ -297,5 +229,5 @@ gulp.task('demo', ['build'], $.shell.task([
'node test/demo/demo.js'
]))

// An alias of test
gulp.task('default', ['test']);
// An alias of build
gulp.task('default', ['build']);
7 changes: 0 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"description": "A library for visualizing data trees built on top of D3.",
"main": "dist/dTree.js",
"scripts": {
"test": "gulp",
"test-browser": "gulp test-browser",
"build": "gulp build",
"coverage": "gulp coverage",
"demo": "gulp demo",
Expand Down Expand Up @@ -37,7 +35,6 @@
"babel-eslint": "^4.0.5",
"babelify": "^6.0.0",
"browserify": "^11.0.1",
"chai": "^3.2.0",
"connect": "^3.4.0",
"conventional-changelog": "^0.5.3",
"conventional-github-releaser": "^0.5.1",
Expand All @@ -56,7 +53,6 @@
"gulp-jscs": "^2.0.0",
"gulp-livereload": "^3.4.0",
"gulp-load-plugins": "^0.10.0",
"gulp-mocha": "^2.0.0",
"gulp-notify": "^2.1.0",
"gulp-plumber": "^1.0.1",
"gulp-preprocess": "^2.0.0",
Expand All @@ -68,12 +64,9 @@
"isparta": "~3.0.3",
"jquery": "^2.1.4",
"minimist": "^1.2.0",
"mocha": "^2.1.0",
"rollup": "^0.41.4",
"run-sequence": "^1.0.2",
"serve-static": "^1.10.0",
"sinon": "^1.12.2",
"sinon-chai": "^2.7.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.0.0",
"watchify": "^3.3.1"
Expand Down
17 changes: 0 additions & 17 deletions test/.eslintrc

This file was deleted.

27 changes: 0 additions & 27 deletions test/runner.html

This file was deleted.

9 changes: 0 additions & 9 deletions test/setup/browserify.js

This file was deleted.

6 changes: 0 additions & 6 deletions test/setup/node.js

This file was deleted.

15 changes: 0 additions & 15 deletions test/setup/setup.js

This file was deleted.

5 changes: 0 additions & 5 deletions test/unit/dtree.js

This file was deleted.

Loading

0 comments on commit 938395a

Please sign in to comment.