substance-test

0.15.0 • Public • Published

substance-test

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}'`
}).join('\n');
rollup.rollup({
  entry: 'index.js',
  plugins: [
    hypothetical({
      files: {
        'index.js': index
      },
      allowRealFiles: true
    }),
  ],
  // let rollup skip tape
  external: ['tape'],
}).then((bundle) => {
  bundle.write({
    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:

<html>
  <head>
    <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> 
  </head>
</html>

Then open this file in your browser.

Readme

Keywords

none

Package Sidebar

Install

npm i substance-test

Weekly Downloads

14

Version

0.15.0

License

MIT

Unpacked Size

4.71 MB

Total Files

11

Last publish

Collaborators

  • michael
  • oliver