From c82f98015af9a0e887a39fb0dc2fadbb8648a567 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Wed, 13 Jul 2016 22:46:40 +0200 Subject: [PATCH] minor code style tweaks --- profile.js | 1 + types/make.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/profile.js b/profile.js index 0cb78b760..beadc8dc7 100644 --- a/profile.js +++ b/profile.js @@ -105,6 +105,7 @@ events.on('results', function (data) { if (console.profileEnd) { console.profileEnd(); } + console.log('RESULTS:', data.stats); if (process.exit) { diff --git a/types/make.js b/types/make.js index 0fa222dac..f33fb2f6f 100644 --- a/types/make.js +++ b/types/make.js @@ -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; } @@ -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; @@ -107,6 +113,7 @@ function isSorted(a) { return false; } } + return true; } @@ -114,11 +121,14 @@ function isSorted(a) { 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; }