Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature alexamil 1513931385131 #256

Merged
merged 22 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dist/

### matching files
*.log
test/.suman/.meta/*.html

### files
yarn.lock
Expand Down
Empty file added build/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ else if (installGlobals) {
require('./lib/cli-commands/install-global-deps')(paths);
}
else if (sumanShell) {
debugger;
require('./lib/cli-commands/run-suman-shell').run(projectRoot, sumanLibRoot, sumanOpts.suman_d_opts);
}
else if (interactive) {
Expand Down
1 change: 1 addition & 0 deletions cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ else if (installGlobals) {
require('./lib/cli-commands/install-global-deps')(paths);
}
else if (sumanShell) {
debugger;
require('./lib/cli-commands/run-suman-shell').run(projectRoot, sumanLibRoot, sumanOpts.suman_d_opts)
}
else if (interactive) {
Expand Down
17 changes: 8 additions & 9 deletions config/suman-constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ exports.constants = Object.freeze({
describe: true,
before: true,
after: true,
beforeeachblock: true,
aftereachblock: true,
beforeall: true,
afterall: true,
beforeeach: true,
Expand Down Expand Up @@ -112,15 +114,12 @@ exports.constants = Object.freeze({
PRE_VALS_ERROR: 99
},
ERROR_MESSAGES: {
INVALID_FUNCTION_TYPE_USAGE: ' => Suman fatal error => Note that by default Suman does not allow you to use arrow ' +
'functions with test blocks.\n' +
'\n => You can change this by setting "allowArrowFunctionsForTestBlocks" to true in your suman.conf.js file.\n' +
'\n => In any case, you cannot use generators or async/await with test block callbacks.\n' +
'This is because test block callbacks need to register' +
' all hooks and test cases synchronously,\nwhich is why generator functions and async/await ' +
'are not permitted.\nNote that if you choose to use arrow functions with test blocks, the expected value for "this" will not be bound correctly,\n' +
'so as an alternative it is best practice to simply inject the "suite" value which would be the same value for "this".\n' +
'Please see: xxx.'
INVALID_FUNCTION_TYPE_USAGE: [
'Suman fatal error: Note that Suman does not allow you to use async or generator functions with test blocks.',
'This is because test block callbacks need to register all hooks and test cases synchronously,',
'which is why generator functions and async/await are not permitted.'
]
.join('\n')
},
runner_message_type: {
BROWSER_FINISHED: 'BROWSER_FINISHED',
Expand Down
63 changes: 31 additions & 32 deletions config/suman-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,42 @@
import * as chalk from 'chalk';

export const constants = Object.freeze({

SUMAN_ISSUE_TRACKER_URL: 'https://github.com/sumanjs/suman/issues',
SUMAN_TYPES_ROOT_URL: 'https://github.com/sumanjs/suman-types/blob/master/dts',

DEFAULT_TRANSFORM_CONCURRENCY: 3,
DEFAULT_PARALLEL_TOTAL_LIMIT: 30,
DEFAULT_PARALLEL_TEST_LIMIT: 10,
DEFAULT_PARALLEL_BLOCK_LIMIT: 10,

DEFAULT_CHILD_PROCESS_TIMEOUT: 6000000,

OLDEST_SUPPORTED_NODE_VERSION: 'v6.0.0',

DEBUGGING_ENV: {
name: 'SUMAN_DEBUG',
value: 'yes'
},

SUMAN_SERVER_MESSAGE: 'SUMAN_SERVER_MESSAGE',

UNKNOWN_INJECT_HOOK_NAME: '(unknown inject-hook name)',

SUMAN_HOOK_FATAL_WARNING_MESSAGE:
'Suman non-fatal error => Error in hook and "fatal" option for the hook is set to false =>\n',

SUMAN_HOOK_FATAL_MESSAGE:
' => fatal error in hook => (to continue even in the event of an error in a hook, use option {fatal:false}) =>\n',

SUMAN_HARD_LIST: Object.keys({

// all lowercase
describe: true,
before: true,
after: true,
beforeeachblock: true,
aftereachblock: true,
beforeall: true,
afterall: true,
beforeeach: true,
Expand All @@ -49,7 +51,7 @@ export const constants = Object.freeze({
setuptest: true,
teardowntest: true,
context: true,

//all
$root: true, // root of project
$macro: true,
Expand All @@ -59,15 +61,15 @@ export const constants = Object.freeze({
$deps: true,
extraargs: true,
userdata: true,

}),

CORE_MODULE_LIST: require('builtin-modules'),

CLI_EXIT_CODES: {
NO_GROUP_NAME_MATCHED_COMMAND_LINE_INPUT: 20,
},

RUNNER_EXIT_CODES: {
NO_TEST_FILE_OR_DIR_SPECIFIED: 30,
ERROR_INVOKING_NETWORK_LOG_IN_RUNNER: 31,
Expand All @@ -76,7 +78,7 @@ export const constants = Object.freeze({
NO_TEST_FILES_MATCHED_OR_FOUND: 34,
UNCAUGHT_EXCEPTION: 777
},

EXIT_CODES: {
SUCCESSFUL_RUN: 0,
WHOLE_TEST_SUITE_SKIPPED: 0,
Expand Down Expand Up @@ -133,19 +135,16 @@ export const constants = Object.freeze({
IOC_STATIC_ACQUISITION_ERROR: 98,
PRE_VALS_ERROR: 99
},

ERROR_MESSAGES: {
INVALID_FUNCTION_TYPE_USAGE: ' => Suman fatal error => Note that by default Suman does not allow you to use arrow ' +
'functions with test blocks.\n' +
'\n => You can change this by setting "allowArrowFunctionsForTestBlocks" to true in your suman.conf.js file.\n' +
'\n => In any case, you cannot use generators or async/await with test block callbacks.\n' +
'This is because test block callbacks need to register' +
' all hooks and test cases synchronously,\nwhich is why generator functions and async/await ' +
'are not permitted.\nNote that if you choose to use arrow functions with test blocks, the expected value for "this" will not be bound correctly,\n' +
'so as an alternative it is best practice to simply inject the "suite" value which would be the same value for "this".\n' +
'Please see: xxx.'
INVALID_FUNCTION_TYPE_USAGE: [
'Suman fatal error: Note that Suman does not allow you to use async or generator functions with test blocks.',
'This is because test block callbacks need to register all hooks and test cases synchronously,',
'which is why generator functions and async/await are not permitted.'
]
.join('\n')
},

runner_message_type: {
BROWSER_FINISHED: 'BROWSER_FINISHED',
FATAL: 'FATAL',
Expand All @@ -158,7 +157,7 @@ export const constants = Object.freeze({
MAX_MEMORY: 'MAX_MEMORY',
TABLE_DATA_RECEIVED: 'TABLE_DATA_RECEIVED'
},

warnings: {
NO_DONE_WARNING: chalk.bold('Warning: no done referenced in callback'),
RETURNED_VAL_DESPITE_CALLBACK_MODE: chalk.bold('Warning: callback mode is set, but a non-null value was returned by the hook.'),
Expand All @@ -168,9 +167,9 @@ export const constants = Object.freeze({
'You may have forgotten to fire a callback, or perhaps the timeout quantity is too short.'),
DELAY_TIMED_OUT_ERROR: chalk.bold('Error: *timed out* - did you forget to call resume()?')
},

tableData: {

SUITES_DESIGNATOR: {
name: ' ▼ Test entry path ▼ ',
default: '(!! suman error !!)'
Expand Down Expand Up @@ -208,5 +207,5 @@ export const constants = Object.freeze({
default: '-'
}
}

});
61 changes: 51 additions & 10 deletions dev-scripts/exp/exp.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,63 @@
// };
//
//


// const util = require('util');
//
// process.on('warning', function (w) {
// console.warn(w.name);
// console.warn(w.stack);
// console.warn(w.message);
// console.warn(w.code);
// });
//
//
// process.emitWarning('Something happened!');

const doc = {foo:'bar'};

(function () {

var scope = Object.create(null);
var obscurer = {};
for (var key in doc) {
obscurer[key] = undefined;
}

with (obscurer) {
var isolated = function() {
'use strict';
console.log(doc);
};
}

isolated.call(scope);
})();



// const time = Date.now();
//
//
// for(let i = 0; i < 1000000; i++){
// var z = function () {
//
// }
// new Proxy({}, {
// set: function () {
// return true;
// }
// })
// }
//
//
// console.log(Date.now() - time);


let err = false;

let z = !err;


console.log('z => ',z );
// const getNewError = function () {
// return {message: 'bar',stack:'bar'};
// };
//
// let err = true;
//
// let z = !err && getNewError();
//
//
// console.log('z => ',z );
10 changes: 2 additions & 8 deletions dev-scripts/exp/exp3.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
declare class Person {
name: string;
constructor(name: string);
greet(greeting: string): string;
declare class Bar {
}
interface Person {
hi: typeof Person.prototype.greet;
}
declare const p: Person;
declare const makeBar: () => Bar;
15 changes: 6 additions & 9 deletions dev-scripts/exp/exp3.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
var Person = (function () {
function Person(name) {
this.name = name;
var Bar = (function () {
function Bar() {
}
Person.prototype.greet = function (greeting) { return greeting + ", " + this.name; };
return Person;
return Bar;
}());
Person.prototype.hi = Person.prototype.greet;
var p = new Person("Alice");
console.log(p.greet("Hey"));
console.log(p.hi("Hi"));
var makeBar = function () {
return new (Bar.bind.apply(Bar, [void 0].concat(arguments)))();
};
32 changes: 21 additions & 11 deletions dev-scripts/exp/exp3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,30 @@
//
// debugger;

//
// class Person {
// constructor(public name: string) {}
// greet(greeting: string): string { return `${greeting}, ${this.name}`; }
// }
//
// interface Person {
// hi: typeof Person.prototype.greet;
// }
//
//
// Person.prototype.hi = Person.prototype.greet;
//
// const p = new Person("Alice");
// console.log(p.greet("Hey"));
// console.log(p.hi("Hi"));

class Person {
constructor(public name: string) {}
greet(greeting: string): string { return `${greeting}, ${this.name}`; }
}

interface Person {
hi: typeof Person.prototype.greet;
}
class Bar {

}

Person.prototype.hi = Person.prototype.greet;
const makeBar = function () {
return new Bar(...arguments);
};

const p = new Person("Alice");
console.log(p.greet("Hey"));
console.log(p.hi("Hi"));

2 changes: 0 additions & 2 deletions dev-scripts/exp/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
// });




const o = {};

Object.defineProperty(o,'foo', {
Expand Down
2 changes: 1 addition & 1 deletion dev-scripts/travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e;

npm link -f --silent > /dev/null 2>&1
npm link suman -f --silent > /dev/null 2>&1
suman --force test/src/dev/node/injection.test.js
suman --force test/src/dev/node/3.test.js
6 changes: 3 additions & 3 deletions lib/cli-commands/init-opt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ exports.run = function (opts, projectRoot, cwd) {
}
try {
if (!fforce) {
var p_1 = path.resolve(projectRoot + '/' + (conf ? (conf.sumanHelpersDir || '/suman') : '/suman'));
_suman.log.info(' => Looking for existing suman helpers dir here => "' + p_1 + '"');
var files = fs.readdirSync(p_1);
var p = path.resolve(projectRoot + '/' + (conf ? (conf.sumanHelpersDir || '/suman') : '/suman'));
_suman.log.info(' => Looking for existing suman helpers dir here => "' + p + '"');
var files = fs.readdirSync(p);
sumanHelperDirFound = true;
files.forEach(function (file) {
if (!sumanAlreadyInittedBecauseConfFileExists) {
Expand Down
1 change: 1 addition & 0 deletions lib/default-conf-files/suman.default.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
logsDir: process.env['SUMAN_LOGS_DIR'],

//boolean
allowRunInPlace: true, // allow test files to be run if they are in the same folder as @run.sh file
viewGantt: false,
retriesEnabled: false,
useColorByDefault: true,
Expand Down
Loading