node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »



A test-suite based on tape.

Running tape tests in the Substance TestSuite

Install substance-test:

$ npm install --save-dev substance-test

Bundle your tests using rollup:

var glob = require('glob');
var rollup = require('rollup');
var hypothetical = require('rollup-plugin-hypothetical')
// Create an index file for all tests 
let index = glob.sync('test/*.js').map((f) => {
  return `import './${f}'`
  entry: 'index.js',
  plugins: [
      files: {
        'index.js': index
      allowRealFiles: true
  // let rollup skip tape 
  external: ['tape'],
}).then((bundle) => {
    format: 'umd', moduleName: 'tests',
    dest: 'dist/tests.js',
    globals: {
      // instead of using tape directly 
      // we want to use the one managed by the test suite 
      tape: 'substanceTest.test'

Create an HTML file like the following:

    <title>My TestSuite</title>
    <link href='node_modules/substance-test/dist/test.css' rel='stylesheet' type='text/css'/>
    <script type="text/javascript" src="node_modules/substance-test/dist/testsuite.js"></script> 
    <script type="text/javascript" src="dist/tests.js"></script> 

Then open this file in your browser.