tunnckoCore / blankr

:heart: tasks, todos, ideas, streaks, WIP, etc
https://i.am.charlike.online
4 stars 1 forks source link

About Task, Bench and Test runners #27

Open tunnckoCore opened 9 years ago

tunnckoCore commented 9 years ago

Actually they are same things.

// task runner
.task('name', asyncFn);
.task('task2', asyncFn);
.run('name', 'task2');

// bench - matcha
suite('title', function() {
  bench('sub-title', asyncFn)
});

// test - mocha
describe('title', function() {
  it('sub-title', asyncFn)
});

// test - mukla
mukla('package-name:').should('have title').then('and sub-title', asyncFn);

// or
mukla('package-name:').should('title', asyncFn)

One basic task runner, actually, is just simple event emitter.

var runner = new DualEmitter();
runner
.on('task1', asyncFn)
.on('task2', asyncFn)
.emit('task1', 'task2')
tunnckoCore commented 9 years ago

the proof

note Undertaker is awesome!

possible problems

plus


Soon will be commited to own repos and published.

tunnckoCore commented 9 years ago

Goddie will power more awesome task, test and bench runners than Undertaker can currently.

tunnckoCore commented 9 years ago

Erasm, Mukla, Berck, Docks, Ock, Bruck, Barrack, Blitzcrank, benz, godware, goddie.

names

tunnckoCore commented 8 years ago

future assertion

// .ok(value, [message]) / .truthy
// Assert that value is truthy.

// .notOk(value, [message]) / .falsey
// Assert that value is falsy.

// .true(value, [message])
// Assert that value is true.

// .false(value, [message])
// Assert that value is false.

// .is(value, expected, [message]) - not strict / (.equal - strict?) / (.strictEqual - maybe as .same fallback)
// Assert that value is (strict) equal to expected.

// .not(value, expected, [message]) - not strict / (.notEqual - strict?) / (.notStrictEqual - maybe as .notSame fallback)
// Assert that value is not (strict) equal to expected.

// .same(value, expected, [message]) / .deepEqual / .deep
// Assert that value is deep equal to expected.

// .notSame(value, expected, [message]) / .notDeepEqual / .notDeep
// Assert that value is not deep equal to expected.

// .ifError(value, [message])
// Assert that value is error.

// experimental thoughts
mukla('package-name header')
.parallel(function () {
  return this
    .equal('fs.readFile should be function', typeof fs.readFile, 'function')
    .true('not have body property', isEmptyFunction('(a) => {}'))
    .same('abc should be [1, 2, 3]', abc, [1, 2, 3])
    .true('fs.readFile should be function', Array.isArray([1, 2]))
    .it('should have some test title', function (cb) {
      mukla.plan(3)
      fs.readFile('./package.json', function (err, res) {
        mukla.ifError(err)
        mukla.equal(typeof res, 'function')
        mukla.equal(JSON.parse(res).name, 'mukla')
        cb() // or mukla.end()
      })
    })
    .series(function () {
      return this
        .true('not have body property', isEmptyFunction('(a) => {}'))
        .same('abc should be [1, 2, 3]', abc, [1, 2, 3])
        .equal('fs.readFile should be function', typeof fs.readFile, 'function')
    })
})
.on('pass', function (title, info) {
  console.log('ok:', title, info)
})