From b0a4afccf5168f0e3cad39040f0dc80e2898e183 Mon Sep 17 00:00:00 2001 From: Simon Ho Date: Thu, 26 Jan 2017 18:59:45 -0800 Subject: [PATCH] Project cleanup * Fix tabbing in loopback/index.js * Remove unused gherkin.ts in root test directory * Lexical order global type definitions * Group test dependencies (expect/sinon) into single global file in root test directory * Modify both mocha.opts to import single global file instead of expect/sinon separately --- packages/loopback/index.ts | 8 ++++---- test/gherkin.ts | 18 ------------------ test/global-types.d.ts | 8 ++++---- test/{expect.ts => globals.ts} | 5 +++-- test/mocha.opts.black-box | 4 +--- test/mocha.opts.white-box | 4 +--- test/sinon.ts | 1 - 7 files changed, 13 insertions(+), 35 deletions(-) delete mode 100644 test/gherkin.ts rename test/{expect.ts => globals.ts} (51%) delete mode 100644 test/sinon.ts diff --git a/packages/loopback/index.ts b/packages/loopback/index.ts index f171ba262305..962d247f99f5 100644 --- a/packages/loopback/index.ts +++ b/packages/loopback/index.ts @@ -1,5 +1,5 @@ export { - Application, - AppConfig, - AppState -} from './lib/application'; \ No newline at end of file + Application, + AppConfig, + AppState +} from './lib/application'; diff --git a/test/gherkin.ts b/test/gherkin.ts deleted file mode 100644 index 174fe575259c..000000000000 --- a/test/gherkin.ts +++ /dev/null @@ -1,18 +0,0 @@ -global['AsA'] = function(description : string, cb) { - describe(description, cb); -}; -global['Scenario'] = function(description : string, cb) { - context(description, cb); -}; -global['Given'] = function(description : string, cb) { - before(description, cb || function() {}); -}; -global['And'] = function(description : string, cb) { - before(description, cb || function() {}); -}; -global['When'] = function(description : string, cb) { - before(description, cb || function() {}); -}; -global['Then'] = function(description : string, cb) { - it(description, cb); -}; \ No newline at end of file diff --git a/test/global-types.d.ts b/test/global-types.d.ts index 15fa4199f68b..7aff548ed53f 100644 --- a/test/global-types.d.ts +++ b/test/global-types.d.ts @@ -1,8 +1,8 @@ +declare var And : any; declare var expect : Function; declare var Feature : Function; -declare var Scenario : any; declare var Given : any; -declare var And : any; -declare var When : any; +declare var Scenario : any; +declare var sinon : any; declare var Then : any; -declare var sinon : any; \ No newline at end of file +declare var When : any; \ No newline at end of file diff --git a/test/expect.ts b/test/globals.ts similarity index 51% rename from test/expect.ts rename to test/globals.ts index d1a3e0965476..c1ec68cd21cf 100644 --- a/test/expect.ts +++ b/test/globals.ts @@ -1,7 +1,8 @@ import chai = require('chai'); import dirtyChai = require('dirty-chai'); +import sinon = require('sinon'); chai.use(dirtyChai); -const expect = chai.expect; -global['expect'] = expect; \ No newline at end of file +global['expect'] = chai.expect; +global['sinon'] = sinon; \ No newline at end of file diff --git a/test/mocha.opts.black-box b/test/mocha.opts.black-box index 17488e2f8fdd..4db7b03fa9e7 100644 --- a/test/mocha.opts.black-box +++ b/test/mocha.opts.black-box @@ -1,7 +1,5 @@ --require ../../test/ts-node.js --compilers ts:tsconfig-paths/register ---require ../../test/gherkin.ts ---require ../../test/expect.ts ---require ../../test/sinon.ts +--require ../../test/globals.ts --ui mocha-gherkin --reporter mocha-gherkin/build/spec test/black-box/**/*.ts diff --git a/test/mocha.opts.white-box b/test/mocha.opts.white-box index e0b4d194a527..e4e0e75a2925 100644 --- a/test/mocha.opts.white-box +++ b/test/mocha.opts.white-box @@ -1,7 +1,5 @@ --require ../../test/ts-node.js --compilers ts:tsconfig-paths/register ---require ../../test/gherkin.ts ---require ../../test/expect.ts ---require ../../test/sinon.ts +--require ../../test/globals.ts --ui tdd test/white-box/**/*.ts diff --git a/test/sinon.ts b/test/sinon.ts deleted file mode 100644 index b4a0ccab35e1..000000000000 --- a/test/sinon.ts +++ /dev/null @@ -1 +0,0 @@ -global['sinon'] = require('sinon');