How to use suman - 10 common examples

To help you get started, we’ve selected a few suman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sumanjs / suman / test / src / exp / es5-es6 / test-tests / generatorz.js View on Github external
const suman = require('suman');
const Test = suman.init(module, {});

Test.describe('root suite description', {}, function () {   // we define the root suite

  //note: we are in the context of the "root suite"

  const self = this;    // (avoid the self pattern in Suman tests, here for explanation only :)

  this.before(function * () {
    const bnans = yield new Promise(function (resolve) {
      resolve('bananas')
    });
    console.log('bananas:', bnans);
    console.log('1', this === self); //true
  });

  this.beforeEach(function * () {
github sumanjs / suman / test / src / exp / babel / babel / src / await.js View on Github external
#!/usr/bin/env node

'use strict';

const suman = require('suman');
const Test = suman.init(module, {});


Test.create('root suite description', {}, function () {   // we define the root suite

  //note: we are in the context of the "root suite"

  const self = this;    // (avoid the self pattern in Suman tests, here for explanation only :)

  this.before('aeageo', async function () {
    const bnans = await new Promise(function (resolve) {
      resolve('bananas')
    });
    console.log('bananas:', bnans);
    console.log('1', this === self); //true
  });
github sumanjs / suman / test / src / exp / es5-es6 / a.js View on Github external
#!/usr/bin/env node
'use strict';

const suman = require('suman');
const Test = suman.init(module, {
  $inject: ['abc']
});

Test.create(['parallel: true', (b, assert, before, beforeEach, it, after, describe) => {

  console.log('arguments => ', arguments);

  before(['fatal:false', t => {
    // throw new Error('hook');
  }]);

  before(t => {
    console.log('before a');
  });

  beforeEach.cb({}, t => {
github sumanjs / suman / test / src / exp / es5-es6 / integration-tests / test2.js View on Github external
'use strict';

var suman = require('suman');
var Test = suman.init(module, {
  timeout: 10000,
  integrants: [ 'smartconnect', 'dolce-vida', 'charlie' ]
});

// (suite 2 below has error in hook)

Test.describe('suite 1', { parallel: true }, function () {

  this.before.cb('D', t => {
    t.done();
  });

  const cars = [ 1, 2, 3 ];

  this.describe('x', function () {
github sumanjs / suman / test / src / exp / babel / test-es7 / test6.js View on Github external
/**
 * Created by denman on 3/26/2016.
 */

const suman = require('suman');
const Test = suman.init(module, {
  interface: 'BDD'   //BDD interface is default but we are explicit
});

// here we create the test suite, we can pass in core modules, and any value defined in suman.ioc.js
Test.create('#Test1', function (assert, fs, http, path, describe, it, beforeEach) {

  describe('tests multiplication', function () {

    beforeEach(t => {   //this runs before any test case inside this describe block
      t.data.foo = 3;
    });

    it('[test] 1', async (t) => {  // t represents this test case, t.data properties can be set prior in hooks

      const bar = await new Promise(function (resolve) {
        resolve('7');
github sumanjs / suman / test / src / exp / babel / test-es7 / two.js View on Github external
import * as suman from 'suman';  //es6 import syntax

const Test = suman.init(module, {
	interface: 'BDD',   //BDD interface is default but we are explicit
	iocData: makeIOCData()
});

function makeIOCData() {

}

// here we create the test suite, we can pass in core modules, and any value defined in suman.ioc.js
Test.describe('#Test1', function (assert, fs, http, path) {

	this.describe('tests multiplication', function () {

		this.beforeEach(t => {   //this runs before any test case inside this describe block
			t.data.foo = 3;
		});
github sumanjs / suman / test / src / exp / babel / babel / target / await.js View on Github external
var _regenerator = require('babel-runtime/regenerator');

var _regenerator2 = _interopRequireDefault(_regenerator);

var _promise = require('babel-runtime/core-js/promise');

var _promise2 = _interopRequireDefault(_promise);

var _asyncToGenerator2 = require('babel-runtime/helpers/asyncToGenerator');

var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var suman = require('suman');
var Test = suman.init(module, {});

Test.create('root suite description', {}, function () {
  // we define the root suite

  //note: we are in the context of the "root suite"

  var self = this; // (avoid the self pattern in Suman tests, here for explanation only :)

  this.before('aeageo', (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee() {
    var bnans;
    return _regenerator2.default.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return new _promise2.default(function (resolve) {
github sumanjs / suman / test / src / exp / exp.js View on Github external
'use strict';

const suman = require('suman');
const Test = suman.init(module, {
  override: {
    opts: {
      allowSkip: true
    }
  }
});

Test.create(function (b,it, before, beforeEach, describe, context, after) {


  // beforeEach.cb(h => {
  //   return Promise.delay(2000);
  // });

  it.Cb('should pass');
github sumanjs / suman / src / default-conf-files / suman.skeleton.ts View on Github external
#!/usr/bin/env node
'use strict';

const suman = require('suman');
const {Test} = suman.init(module);


//////////////////////////////////////////////////////////////////////////


Test.create(['semver', function (b, assert, describe, before, beforeEach, after, afterEach, it) {

  const semver = b.ioc.semver; // semver

  console.log('semver => ', semver);

  before('adds foo', h => {
    return Promise.resolve('foo').then(function (v) {
      h.assert(v === 'foo');
      h.$inject.bar = v;
    });
github sumanjs / suman / test / src / exp / programmatic / strm-sync-tests / test7.js View on Github external
cb();
    },

    end: function (data) {
        console.log('end was called with data=', data);
    }

});

writable.on('finish', function () {
    writable.finished = true;
});


const Test = suman.init(module, {
    export: true,
    interface: 'TDD',
    writable: writable
});


Test.suite('@Test1', {parallel: false, bail: true}, function (assert, fs, path, stream, extra) {


    tests.forEach(test=> {

        this.test('tests data', function () {

            test(assert);

        });

suman

Suman is an advanced, singular, Node.js test runner designed to supercede Mocha and rival AVA

MIT
Latest version published 6 years ago

Package Health Score

42 / 100
Full package analysis

Popular suman functions