Code Monkey home page Code Monkey logo

gulp-busterjs's Introduction

gulp-busterjs Build Status

This module allows you to run your BusterJS tests with gulp. It will also replace your configuration file and generate them on each test run for you.

Installation

npm install --save-dev buster gulp gulp-busterjs

Please note that gulp-busterjs will not bundle buster for you. You need to add it on your own.

Getting started

Using the module is as simple as that:

"use strict";

var gulp   = require("gulp");
var buster = require("gulp-busterjs");

gulp.task("test", function () {
  gulp
    .src("./test/**/*-test.js")
    .pipe(buster());
});

If you want to run different buster configurations separated from each other you can also do this:

"use strict";

var gulp   = require("gulp");
var buster = require("gulp-busterjs");

gulp.task("test", ["test-unit", "test-integration"], function () {});

gulp.task("test-unit", function () {
  gulp
    .src("./test/unit/**/*-test.js")
    .pipe(buster({ name: "unit" }));
});

gulp.task("test-integration", function () {
  gulp
    .src("./test/integration/**/*-test.js")
    .pipe(buster({ name: "integration" }));
});

You can also pass additional options to the buster function:

gulp.task("test", function () {
  gulp
    .src("./test/**/*-test.js")
    .pipe(buster({
      name:         "my lovely configuration name", // default: "testrun 123"
      environment:  "browser",                      // default: "node"
      rootPath:     "my/tests",                     // default: process.cwd()
      tests:        [],                             // default: the gulp files
      failOnStderr: false,                          // default: true
      useHeadlessBrowser: true,                     // default: false. Will spawn a headless phantom browser before running the tests.
      transformSpawnArgs: function (args) {
        return args;
      }
    }));
});

gulp-busterjs's People

Contributors

sdepold avatar greenkeeperio-bot avatar johanneswuerbach avatar

Stargazers

James Wyse avatar Eisi Sig avatar Eak Netpanya avatar

Watchers

 avatar James Cloos avatar  avatar

gulp-busterjs's Issues

Edit/Delete Config File?

I was recently going through this task's code and, while I'm not a master of Node by any means, I noticed it deletes a config file if it finds any in the current folder before it generates a new one. Now, my first question is: do we even need to delete this file? Gulp operates on streams, which means you don't need to do operations on actual files, but rather on the virtual vinyl-fs provided. Therefore, unless we were explicitly creating a new config file and adding it in (which we aren't), we shouldn't need to delete the old one.

We could even delete the config file in the vinyl-fs and generate a new one, but not "commit" this operation to the filesystem. We shouldn't even need to do this, however, because we could just generate a new one in vinyl and not even touch the filesystem.

A better way seems to be to take the options in the repo's current config file into the stream, then merge in some options we provide, deleting any that conflict. This way, we take into account the user's config file, not assuming anything, then merge the options the user provided in the task, then provide defaults if any options are still missing

I am not worried about my buster file being deleted, by the way, as it is in a subfolder, and I have my repo on git anyway. I am worried about any task that deletes my files without me telling it to, however, as, even if I know what it deletes now, if it updates it could pull a fast one before I realize what it's done. I am not suggesting this is what I think of this task, merely suggesting that this is what other users may think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.