Skip to content

Commit

Permalink
Commit via private local repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ORESoftware committed May 6, 2016
1 parent c3aa812 commit 3c1df70
Show file tree
Hide file tree
Showing 16 changed files with 156 additions and 28 deletions.
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,8 @@ NUL
.idea/
node_modules/
bower_components/
test_sc
test_sc_dest
bugs
coverage
docs
jsdoc-out
mr-docs
_future
jsdoc-notes.txt
makefile
makefile2
exp*.js

15 changes: 15 additions & 0 deletions bugs/bug0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on windows machine

node C:\Users\denman\WebstormProjects\poolio\test\test-poolio-w-suman.js

and

node C:\Users\denman\WebstormProjects\suman-private\index.js C:\Users\denman\WebstormProjects\poolio\test\test-poolio-w-suman.js

both yield all tests timing out, so seems like some path problem

everything is good when I run this

https://www.dropbox.com/s/ywctusl9zlz9y88/Screenshot%202016-04-28%2020.16.21.png?dl=0

so something really weird is up
7 changes: 5 additions & 2 deletions config/suman-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ module.exports = Object.freeze({
],
CORE_MODULE_LIST: require('builtin-modules'),
RUNNER_EXIT_CODES:{
NO_TEST_FILE_OR_DIR_SPECIFIED: 30,
ERROR_INVOKING_NETWORK_LOG_IN_RUNNER: 31,
UNEXPECTED_FATAL_ERROR: 32,
UNCAUGHT_EXCEPTION: 777

},
EXIT_CODES: {
SUCCESSFUL_RUN: 0,
WHOLE_TEST_SUITE_SKIPPED: 0,
GREP_SUITE_DID_NOT_MATCH: 0,
BAD_GREP_SUITE_OPTION: 52,
SUMAN_UNCAUGHT_EXCEPTION: 53,
Expand All @@ -56,11 +60,10 @@ module.exports = Object.freeze({
ERROR_ACQUIRING_IOC_DEPS: 73,
INVALID_RUNNER_CHILD_PROCESS_STATE: 74,
NO_TIMESTAMP_AVAILABLE_IN_TEST: 75,
ERROR_INVOKING_NETWORK_LOG_IN_RUNNER: 76,
ERROR_CREATED_NETWORK_LOG: 77,
ERROR_CREATING_RESULTS_DIR: 78,
COULD_NOT_FIND_CONFIG_FROM_PATH: 79,
TEST_ERROR_AND_BAIL_IS_TRUE: 80
TEST_ERROR_AND_BAIL_IS_TRUE: 80,
},
ERROR_MESSAGES: {
INVALID_FUNCTION_TYPE_USAGE: 'You cannot use an arrow function with describe callbacks; however, you may use arrow functions everywhere else.\n' +
Expand Down
Empty file added examples/66-suman-exit-codes.md
Empty file.
6 changes: 3 additions & 3 deletions exp-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Test.describe('root suite description', {}, function () { // we define the roo
console.log('2', this === self); //true
});

this.it(function () {
this.it('A', function () {
console.log('3', this === self); //true
});

Expand All @@ -39,7 +39,7 @@ Test.describe('root suite description', {}, function () { // we define the roo
console.log('7', this === that); //true
});

this.it(function () {
this.it.only('B', function () {
console.log('8', this === that); //true
});

Expand All @@ -59,7 +59,7 @@ Test.describe('root suite description', {}, function () { // we define the roo
console.log('12', this === ctx); //true
});

this.it(function () {
this.it.only('C', function () {
console.log('13', this === ctx); //true
});

Expand Down
6 changes: 6 additions & 0 deletions exp-3.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Created by denman on 5/3/2016.
*/


const domain = require('domain');
15 changes: 15 additions & 0 deletions gulp-plugin/g.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
var keypress = require('keypress');

// make `process.stdin` begin emitting "keypress" events
keypress(process.stdin);

// listen for the "keypress" event
process.stdin.on('keypress', function (ch, key) {
console.log('got "keypress"', key);
if (key && key.ctrl && key.name == 'c') {
process.stdin.pause();
}
});

//process.stdin.setRawMode(true);
process.stdin.resume();
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
//TODO on ms windows error messages do not always give url/link/path of test file with error
//TODO: https://github.com/nodejs/node/issues/5252#issuecomment-212784934
//TODO: need to determine how to determine if async/await if such
//TODO: add skip option for top-level describe
//TODO: implement Test.on('end') so that we can force exit the test using process.exit()
//TODO: https://github.com/sindresorhus/ava/blob/master/docs/recipes/when-to-use-plan.md
//TODO: if this.it.only is declared need to declare other test cases as "skipped"

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

Expand Down Expand Up @@ -167,7 +168,6 @@ const opts = require('./lib/parse-cmd-line-opts/parse-opts');
global.viaSuman = true;
global.resultBroadcaster = new EE();


if (process.env.NODE_ENV === 'dev_local_debug' || opts.vverbose) {
console.log("# opts:", opts);
console.log("# args:", opts._args);
Expand Down Expand Up @@ -212,7 +212,6 @@ finally {

var sumanConfig, pth;


//TODO: use harmony destructuring args later on
const configPath = opts.config;
const serverName = opts.server_name;
Expand Down Expand Up @@ -359,6 +358,7 @@ else if (init) {

if (dirs.length < 1) {
console.error('\n ' + colors.bgCyan.black(' => Suman error => No test file or dir specified at command line. ') + '\n\n');
process.exit(constants.RUNNER_EXIT_CODES.NO_TEST_FILE_OR_DIR_SPECIFIED);
return;
}
else {
Expand Down Expand Up @@ -426,7 +426,7 @@ else {

if (err) {
console.error(err.stack);
process.exit(constants.EXIT_CODES.ERROR_INVOKING_NETWORK_LOG_IN_RUNNER);
process.exit(constants.RUNNER_EXIT_CODES.ERROR_INVOKING_NETWORK_LOG_IN_RUNNER);
}
else {

Expand Down Expand Up @@ -459,13 +459,13 @@ else {
console.error(colors.magenta(' => Suman warning => (note: You will need to transpile your test files manually' +
' if you wish to use ES7 features, or use $ suman-babel instead of $ suman.)' + '\n' +
' => Suman error => ' + err.stack + '\n'));
process.exit(constants.EXIT_CODES.UNEXPECTED_FATAL_ERROR);
process.exit(constants.RUNNER_EXIT_CODES.UNEXPECTED_FATAL_ERROR);
});


if (dirs.length < 1) {
console.error('\n\t' + colors.bgCyan.black(' => Suman error => No test file or dir specified at command line. ') + '\n\n');
return;
process.exit(constants.RUNNER_EXIT_CODES.NO_TEST_FILE_OR_DIR_SPECIFIED);
}
else {

Expand Down
2 changes: 0 additions & 2 deletions lib/dual/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ module.exports = {
}
}



}
4 changes: 2 additions & 2 deletions lib/get-all-eaches.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function makeGetAllEaches(suman, allDescribeBlocks) {

function getAllBeforesEaches(test) {

var beforeEaches = [];
const beforeEaches = [];
beforeEaches.unshift(test.getBeforeEaches());

function getParentBefores(testId) {
Expand Down Expand Up @@ -46,7 +46,7 @@ function makeGetAllEaches(suman, allDescribeBlocks) {

function getAllAfterEaches(test) {

var afterEaches = [];
const afterEaches = [];
afterEaches.push(test.getAfterEaches());

function getParentAfters(testId) {
Expand Down
10 changes: 9 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ function init($module, $opts) {
});
}
else {
var run = require('./exec-suite').main(suman);
const run = require('./exec-suite').main(suman);

setImmediate(function () { // important: allows for future possibility of multiple test suites referenced in the same file
if (exportTests === true) { //TODO: if we use this, need to make work with integrants/blocked etc.
Expand Down Expand Up @@ -742,10 +742,18 @@ function init($module, $opts) {
});
}

start.skip = start.SKIP = function(){
//TODO: do some process.exit stuff here
process.exit(constants.EXIT_CODES.WHOLE_TEST_SUITE_SKIPPED);
}

start.only = start.ONLY = start;

init.$ingletonian = {
parent: $module.parent, //parent is who required the original $module
file: $module.filename
};

_interface === 'TDD' ? init.$ingletonian.suite = start : init.$ingletonian.describe = start;
return init.$ingletonian;
}
Expand Down
2 changes: 2 additions & 0 deletions lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ function makeExit(messages, timeDiff) {
const table1 = new AsciiTable('Suman Runner Result');
const table2 = new AsciiTable('Overall Consolidated');

//TODO: need to reconcile this with tests files that do not complete
if (typeof tableRows[0] === 'object') {

table1.setHeading.apply(table1, Object.keys(tableRows[0]));
Expand Down Expand Up @@ -574,6 +575,7 @@ function runSingleOrMultipleDirs(grepFile, dirs) {
n.removeAllListeners();
doneCount++;
messages.push({code: code, signal: signal});
//TODO: if bail, need to make that clear to user here
if ((code > 0 && global.sumanOpts.bail) || doneCount >= forkedCPs.length) {
endTime = Date.now();
listening = false;
Expand Down
4 changes: 0 additions & 4 deletions lib/suman.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ function Suman(obj) {
this.usingRunner = obj.usingRunner;
this.config = obj.config;
this.timestamp = obj.timestamp;
this.ctx = {};
this.describeOnlyIsTriggered = false;
this.iocConfiguration = null;
this.deps = null;
Expand Down Expand Up @@ -185,7 +184,6 @@ Suman.prototype.makeExit = function (exitCode) { //TODO this should just be in t
process.nextTick(cb);
}
else {

const d = domain.create();

d.once('error', function (err) {
Expand All @@ -204,7 +202,6 @@ Suman.prototype.makeExit = function (exitCode) { //TODO this should just be in t
if (err) {
process.stdout.write(err.stack);
}

cb(null);
});
});
Expand Down Expand Up @@ -321,7 +318,6 @@ Suman.prototype.logFinished = function ($exitCode) {

if (!$exitCode) {


totalNumberOfSuites = this.allDescribeBlocks.length;

skipped = this.allDescribeBlocks.filter(function (block) {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"gulp-babel": "^6.1.2",
"gulp-rename": "^1.2.2",
"gulp-requirejs": "^0.1.3",
"keypress": "^0.2.1",
"nodejs-dep-check": "^1.2.61",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
Expand Down
46 changes: 46 additions & 0 deletions suman/stdio-logs/test-stderr.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@


>>> Suman start run indiv. @Tue May 03 2016 19:19:48 GMT-0700 (Pacific Daylight Time) >>>

Beginning of run at 1462328388098 = [Tue May 03 2016 19:19:48 GMT-0700 (Pacific Daylight Time)]
Command = ["C:\\Program Files\\nodejs\\node.exe","c:\\Users\\denman\\WebstormProjects\\suman-private\\test\\ava-test\\file1.js"]


Test error: A
stack: Error: 123
at c:\Users\denman\WebstormProjects\suman-private\test\ava-test\file1.js:13:23
at FSReqWrap.cb [as oncomplete] (fs.js:212:19)



Test error: B
stack: Error: 123
at null._onTimeout (c:\Users\denman\WebstormProjects\suman-private\test\ava-test\file1.js:22:23)
at Timer.listOnTimeout (timers.js:92:15)



Test error: C
stack: Error: 456
at Immediate._onImmediate (c:\Users\denman\WebstormProjects\suman-private\test\ava-test\file1.js:31:23)
at processImmediate [as _immediateCallback] (timers.js:383:17)



Test error: D
stack: Error: 789
at c:\Users\denman\WebstormProjects\suman-private\test\ava-test\file1.js:40:23
at doNTCallback0 (node.js:419:9)
at process._tickDomainCallback (node.js:389:13)



<<< Suman end run <<<








45 changes: 45 additions & 0 deletions test/ava-test/file1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Created by denman on 5/3/2016.
*/

const suman = require('../../lib/index');
const Test = suman.init(module);

Test.describe('Catches exceptions', {}, function(fs){

this.it('A', t => {
return new Promise(function(resolve){
fs.exists('foo', function(){
throw new Error('123');
resolve(); // won't get reached, but here for clarity
});
});
});

this.it('B', t => {
return new Promise(function(resolve){
setTimeout(function(){
throw new Error('123');
resolve(); // won't be reached, but here for clarity
}, 100);
});
});

this.it('C', t => {
return new Promise(function(resolve){
setImmediate(function(){
throw new Error('456');
resolve(); // won't be reached, but here for clarity
});
});
});

this.it('D', t => {
return new Promise(function(resolve){
process.nextTick(function(){
throw new Error('789');
resolve(); // won't be reached, but here for clarity
});
});
});
});

0 comments on commit 3c1df70

Please sign in to comment.