This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
const suman = require('suman'); | |
const Test = suman.init(module,'suman.conf.js'); //we now utilize a suman config file which is useful for configuring reporting, IoC, etc | |
Test.describe('SecondExample', ['delay', 'db', 'val'], function(delay, db, val){ // normally we only need to inject a couple of values per test | |
var results = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const assert = require('assert'); | |
const suman = require('suman'); | |
const Test = suman.init(module,'suman.conf.js'); //we now utilize a suman config file which is useful for configuring reporting, IoC, etc | |
Test.describe('SecondExample', function(db, server, request){ // normally we only need to inject a couple of values per test, and we don't really need the dependency array | |
assert(server.isListening); // values are injected asynchronously, so we are already ready to go | |
assert(db.isConnected); // values are injected asynchronously, so we are already ready to go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//use your own version of this file at the root of your project to configure dependency injection | |
module.exports = (suman) => { //load async deps for any of your suman tests | |
suman.configure({ | |
'request': function () { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by amills001c on 2/25/16. | |
*/ | |
var test = require('ava'); | |
var fs = require('fs'); | |
/////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this looks to be a problem | |
//it will print "one" and "two", followed by "2 passed" | |
var test = require('ava'); | |
var fs = require('fs'); | |
var domain = require('domain'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var BufferStream = function () { | |
stream.Transform.apply(this, arguments); | |
this.sumanReady = false; | |
this.buffer = []; | |
}; | |
util.inherits(BufferStream, stream.Transform); | |
BufferStream.prototype._transform = function (chunk, encoding, done) { | |
// custom buffering logic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
dir = sumanConfig.servers['*default'].outputDir; | |
outputPath = path.resolve(dir + '/' + timestamp); | |
fs.mkdir(outputPath, function (err) { | |
cb(err, false, outputPath); | |
}); | |
} | |
catch (err) { | |
console.error(err.stack); | |
cb(err, false); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const suman = require('suman'); | |
const Test = suman.init(module); | |
Test.describe('FirstExample', function(assert, path, http){ // this is our test suite, and we inject some core modules by name | |
this.beforeEach('runs before every it()', t => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const suman = require('suman'); | |
const Test = suman.init(module); | |
Test.describe('SecondExample', function(db, someval, delay, assert){ // normally we only need to inject a couple of values per test | |
var results = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const suman = require('suman'); | |
const Test = suman.init(module); | |
Test.describe('Test inits', {parallel: false}, function (Pool, assert, path) { | |
const data = { | |
size: 5, | |
filePath: path.resolve(__dirname + '/fixtures/sample-file.js') | |
}; |