Skip to content

Commit 4941bbe

Browse files
committed
source
2 parents 90123bd + 0f91079 commit 4941bbe

File tree

20 files changed

+271
-157
lines changed

20 files changed

+271
-157
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ suman.conf.js
1717
.editorconfig
1818
.coveralls.yml
1919
tsconfig*.json
20+

@push.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ git add -A &&
1414
git commit --allow-empty -am "pdev:$CM" &&
1515
git push &&
1616
echo "pushed successfully to remote"
17+

@transpile.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
3+
4+
cd $(dirname "$0") &&
5+
tsc --project tsconfig.json # builds the project
6+
tsc --project tsconfig-test.json # builds the tests
7+
echo "all done transpiling"

cli.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ debug([' => $NODE_PATH is as follows:', process.env.NODE_PATH]);
117117

118118
//////////////////////////////////////////////////////////////////////////
119119

120+
121+
120122
const nodeVersion = process.version;
121123
const oldestSupported = constants.OLDEST_SUPPORTED_NODE_VERSION;
122124

dts/most.d.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
interface Suman {
2+
numHooksSkipped: number,
3+
numHooksStubbed: number
4+
5+
}
6+
7+
8+
type TestSuiteGetterFn <T> = () => Array<T>;
9+
10+
11+
interface AfterObj {
12+
ctx: TestSuite,
13+
timeout: number,
14+
desc: string,
15+
cb: boolean,
16+
throws: RegExp,
17+
planCountExpected: number,
18+
fatal: boolean,
19+
fn: Function,
20+
type: string,
21+
warningErr: Error
22+
}
23+
24+
25+
interface TestSuite {
26+
27+
opts: Object,
28+
testId: number,
29+
isSetupComplete: boolean,
30+
parallel: boolean,
31+
skipped: boolean,
32+
only: boolean,
33+
filename: string,
34+
fileName: string
35+
injectedValues: Object,
36+
getInjections: Function,
37+
getChildren: Function,
38+
getTests: TestSuiteGetterFn<any>,
39+
getParallelTests: TestSuiteGetterFn<any>,
40+
getTestsParallel: TestSuiteGetterFn<any>,
41+
getLoopTests: TestSuiteGetterFn<any>,
42+
getBefores: TestSuiteGetterFn<any>,
43+
getBeforeEaches: TestSuiteGetterFn<any>,
44+
getAfters: TestSuiteGetterFn<AfterObj>,
45+
getAfterEaches: TestSuiteGetterFn<any>
46+
47+
}

lib/create-opt/create.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const fs = require('fs');
1111
const colors = require('colors/safe');
1212
const async = require('async');
1313
const sumanUtils = require('suman-utils');
14+
const mkdirp = require('mkdirp');
1415

1516
//project
1617
const projectRoot = global.projectRoot || sumanUtils.findProjectRoot(process.cwd());
@@ -20,23 +21,31 @@ const projectRoot = global.projectRoot || sumanUtils.findProjectRoot(process.cwd
2021
module.exports = function createTestFiles(paths) {
2122

2223
const p = path.resolve(__dirname, '..', 'default-conf-files/suman.skeleton.js');
23-
2424
const strm = fs.createReadStream(p);
2525

2626
async.each(paths, function (p, cb) {
2727
//TODO: difference between "finish" and "close" events on stream ??
28-
strm.pipe(fs.createWriteStream(p, {flags: 'wx'})).once('error', cb).once('finish', function(){
29-
console.log(' => File was created:', p);
28+
29+
mkdirp(path.dirname(p), function(err){
30+
if(err){
31+
cb(err);
32+
}
33+
else{
34+
strm.pipe(fs.createWriteStream(p, {flags: 'wx'})).once('error', cb).once('finish', function(){
35+
console.log('\n => File was created:', p);
3036
process.nextTick(cb);
31-
});
37+
});
38+
}
39+
});
3240

3341
}, function (err) {
42+
console.log('\n');
3443
if (err) {
35-
console.error('\n', colors.red.bold(' => Suman usage error => ') + colors.red(err.stack || err),'\n');
44+
console.error(colors.red.bold(' => Suman error => ') + colors.red(err.stack || err),'\n');
3645
process.exit(1);
3746
}
3847
else {
39-
console.log('\n',colors.green.bold(' => Suman message => successfully created test skeletons.'),'\n');
48+
console.log(colors.blue.bold(' => Suman message => successfully created test skeleton(s).'));
4049
process.exit(0);
4150
}
4251
});

lib/helpers/slack-integration.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var callable = true;
1212

1313
module.exports = function (opts, cb) {
1414

15+
return process.nextTick(cb);
16+
1517

1618
var callable = true;
1719
const first = function () {
@@ -29,7 +31,7 @@ module.exports = function (opts, cb) {
2931
}
3032

3133
if (!opts.force && opts.optCheck.length < 1) {
32-
// this means that we are executing tests, so the slack integration below will be call later
34+
// this means that we are executing tests, so the slack integration below will be called later
3335
return first();
3436
}
3537

lib/init/install-suman-files.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ module.exports = function (data) {
8080
},
8181
{
8282
src: 'default-conf-files/suman.default.once.js',
83-
dest: newSumanHelperDir + '/suman.once.js'
83+
dest: newSumanHelperDir + '/suman.once.pre.js'
84+
},
85+
{
86+
src: 'default-conf-files/suman.default.once.js',
87+
dest: newSumanHelperDir + '/suman.once.post.js'
8488
},
8589
{
8690
src: 'default-conf-files/suman.default.globals.js',
@@ -119,7 +123,7 @@ module.exports = function (data) {
119123
}
120124
else {
121125
debugInit(' => Appending item to .gitignore file => ', item);
122-
fs.appendFile(gitignore, item, cb);
126+
fs.appendFile(gitignore, '\n' + item + '\n', cb);
123127
}
124128
}, cb);
125129

lib/input-validation/validate-suman.order.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const sumanUtils = require('suman-utils');
1212
const cwd = process.cwd();
1313
const projectRoot = global.projectRoot = (global.projectRoot || sumanUtils.findProjectRoot(cwd));
1414

15+
///////////////////////////////////////////////
16+
1517
module.exports = order => {
1618

1719
const uniqueTestPaths = [];

lib/make-test-suite-base.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
'use strict';
12

3+
//project
24
const incr = require('./incrementer');
35

46
////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)