From 69f55aadc7666cc9fae0b0abfc1f37f26a25a26a Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 19 Feb 2017 21:59:54 +0000 Subject: [PATCH] Move tests --- package.json | 2 +- {src/__tests__ => tests}/helpers.ts | 5 ++--- {src/__tests__ => tests}/server.test.ts | 2 +- tsconfig.json | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) rename {src/__tests__ => tests}/helpers.ts (81%) rename {src/__tests__ => tests}/server.test.ts (95%) diff --git a/package.json b/package.json index ad79735..9b8eb16 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "postinstall": "typings install", "build": "tsc", "test": "npm run build && npm run mocha && nsp check", - "mocha": "mocha --compilers ts:ts-node/register --require scripts/test-helper.js src/__tests__/**.test.ts", + "mocha": "mocha --compilers ts:ts-node/register --require scripts/test-helper.js tests/**.test.ts", "lint": "tslint src/**/*.ts" }, "engines": { diff --git a/src/__tests__/helpers.ts b/tests/helpers.ts similarity index 81% rename from src/__tests__/helpers.ts rename to tests/helpers.ts index afee63b..7132ec0 100644 --- a/src/__tests__/helpers.ts +++ b/tests/helpers.ts @@ -1,9 +1,8 @@ -import createServer from '../server'; -import { Options } from '../types'; +import createServer from '../src/server'; +import { Options } from '../src/types'; import fetch from 'node-fetch'; - export function runServer(opts: Object, url : string, callback: Function) { const app = createServer(opts as Options); const server = app.listen(1234, function () { diff --git a/src/__tests__/server.test.ts b/tests/server.test.ts similarity index 95% rename from src/__tests__/server.test.ts rename to tests/server.test.ts index e53a9b5..ec8946b 100644 --- a/src/__tests__/server.test.ts +++ b/tests/server.test.ts @@ -39,7 +39,7 @@ describe('Server', function () { }); describe('index route', function () { - const body = fs.readFileSync(__dirname + '/../../site/index.html').toString(); + const body = fs.readFileSync(__dirname + '/../site/index.html').toString(); ['', '/', '/index.html'].forEach(function (path : string) { it('should render ' + path, function (done) { diff --git a/tsconfig.json b/tsconfig.json index f2c86b3..ac8db53 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "outDir": "dist", - "rootDir": "src", "allowSyntheticDefaultImports": true, "noImplicitAny": true, "experimentalDecorators": true, @@ -18,7 +17,7 @@ "dist", "node_modules", "scripts/", - "src/__tests__" + "tests/" ], "typeRoots": [ "node_modules",