Coder Social home page Coder Social logo

broccoli-test-builder's Introduction

broccoli-test-builder

A broccoli plugin to build a tree that includes everything necessary to run tests.

Uses broccoli-jshint to run jshint over the src code and test code.

Builds test files into amd modules and concats them into tests/built-amd-tests.js

Transpiles test files from es6 into es5.

Includes an amd loader, qunit.js, qunit.css, and a test-loader. Bring your own tests/index.html.

Assumes:

  • source code is in lib/ (if not, specify a different path with options.libDirName)
  • source code is in es6 format, suitable for transpiling with babel
  • test code is in tests/
  • an index.html exists in tests/

Usage:

var testBuilder = require('broccoli-test-builder');

var options = {
  libDirName: 'path-to-your-lib-dir', // default: 'lib'
};
var testTree = testBuilder.build();

/*
 testTree looks like:
/tests
├── built-amd-tests.js
├── index.html
├── loader.js
│   └── loader.js
├── qunit
│   ├── qunit.css
│   └── qunit.js
└── test-loader
    └── test-loader.js
*/

This is intended to be used with a test index.html that looks like the following. The capitalized variable markers will be replaced with the correct output.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>YOUR TEST TITLE</title>

  @@QUNIT_CSS
</head>
<body>

  @@QUNIT_DOM

  @@QUNIT_JS

  <script src="/testem.js"></script>

  @@LOADER_JS
  <script src="../amd/YOUR-BUILT-AMD-CODE.js"></script>

  @@AMD_TEST_JS
  @@TEST_LOADER_JS
</body>
</html>

broccoli-test-builder's People

Contributors

bantic avatar

Watchers

James Cloos avatar Yoran Brondsema avatar

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.