Skip to content

Commit

Permalink
minor code style tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 13, 2016
1 parent 1dd6d5b commit c82f980
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ events.on('results', function (data) {
if (console.profileEnd) {
console.profileEnd();
}

console.log('RESULTS:', data.stats);

if (process.exit) {
Expand Down
10 changes: 10 additions & 0 deletions types/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ function generatePrefixed(prefix) {

children += generatePrefixed(parts);
}

if (output === '') {
return children;
}

return 'export namespace ' + ['test'].concat(prefix).join('.') + ' {\n' + output + '}\n' + children;
}

Expand All @@ -70,13 +72,17 @@ function writeFunction(name, args) {

function verify(parts, asPrefix) {
const has = arrayHas(parts);

if (has('only') + has('skip') + has('todo') > 1) {
return false;
}

const beforeAfterCount = has('before') + has('beforeEach') + has('after') + has('afterEach');

if (beforeAfterCount > 1) {
return false;
}

if (beforeAfterCount === 1) {
if (has('only')) {
return false;
Expand Down Expand Up @@ -107,18 +113,22 @@ function isSorted(a) {
return false;
}
}

return true;
}

// Returns the type name of for the test implementation
function testType(parts) {
const has = arrayHas(parts);
let type = 'Test';

if (has('cb')) {
type = 'Callback' + type;
}

if (!has('beforeEach') && !has('afterEach')) {
type = 'Contextual' + type;
}

return type;
}

0 comments on commit c82f980

Please sign in to comment.