From 06b95f4df35325fcc58698b570a25b24c3be41e1 Mon Sep 17 00:00:00 2001 From: Nils Hartmann Date: Wed, 26 Oct 2016 21:32:59 +0200 Subject: [PATCH] Make both app and tests compile now. For tests, Node 6.9 needed Due to a bug in ts-loader (https://github.com/TypeStrong/ts-loader/issues/267) tests will always be compiled even from webpack. So I've moved them for now to a separate folder. TODO: need to re-check why type declarations from npm (@types) does not work. --- client/package.json | 4 +--- client/src/components/form/SelectInput.tsx | 4 ++-- client/{src => tests}/__tests__/fetch-mock.js | 0 client/{src => tests}/__tests__/util.test.tsx | 2 +- .../components/form/__tests__/Constraints.test.tsx | 2 +- .../components/form/__tests__/Input.test.tsx | 8 ++++---- client/tsconfig.json | 5 +++-- client/typings.json | 6 ++++-- 8 files changed, 16 insertions(+), 15 deletions(-) rename client/{src => tests}/__tests__/fetch-mock.js (100%) rename client/{src => tests}/__tests__/util.test.tsx (96%) rename client/{src => tests}/components/form/__tests__/Constraints.test.tsx (93%) rename client/{src => tests}/components/form/__tests__/Input.test.tsx (92%) diff --git a/client/package.json b/client/package.json index 1709ec220fa..8736ea45c39 100644 --- a/client/package.json +++ b/client/package.json @@ -8,7 +8,7 @@ "postinstall": "typings install", "install-types": "typings install", "test": "jest", - "test:watch": "jest --watch --no-cache", + "test:watch": "jest --watchAll --no-cache", "start": "node server.js", "build:clean": "rimraf ./public/dist && webpack --config webpack.config.js" }, @@ -27,8 +27,6 @@ "whatwg-fetch": "^1.0.0" }, "devDependencies": { - "@types/enzyme": "^2.4.36", - "@types/jest": "^15.1.32", "babel-core": "^6.4.0", "babel-loader": "^6.2.1", "babel-preset-es2015": "^6.3.13", diff --git a/client/src/components/form/SelectInput.tsx b/client/src/components/form/SelectInput.tsx index cfd5b311996..474e0509541 100644 --- a/client/src/components/form/SelectInput.tsx +++ b/client/src/components/form/SelectInput.tsx @@ -23,10 +23,10 @@ export default ({object, error, name, label, options, onChange}: { object: any,
); -}; \ No newline at end of file +}; diff --git a/client/src/__tests__/fetch-mock.js b/client/tests/__tests__/fetch-mock.js similarity index 100% rename from client/src/__tests__/fetch-mock.js rename to client/tests/__tests__/fetch-mock.js diff --git a/client/src/__tests__/util.test.tsx b/client/tests/__tests__/util.test.tsx similarity index 96% rename from client/src/__tests__/util.test.tsx rename to client/tests/__tests__/util.test.tsx index be7d1659cb7..7bbd1495f75 100644 --- a/client/src/__tests__/util.test.tsx +++ b/client/tests/__tests__/util.test.tsx @@ -1,6 +1,6 @@ require('jest'); -import { url, submitForm } from '../util'; +import { url, submitForm } from '../../src/util'; import * as React from 'react'; diff --git a/client/src/components/form/__tests__/Constraints.test.tsx b/client/tests/components/form/__tests__/Constraints.test.tsx similarity index 93% rename from client/src/components/form/__tests__/Constraints.test.tsx rename to client/tests/components/form/__tests__/Constraints.test.tsx index f7947925b12..36e6cec34a6 100644 --- a/client/src/components/form/__tests__/Constraints.test.tsx +++ b/client/tests/components/form/__tests__/Constraints.test.tsx @@ -1,6 +1,6 @@ require('jest'); -import * as Constraints from '../Constraints'; +import * as Constraints from '../../../../src/components/form/Constraints'; const afunc = ({a}) => {}; diff --git a/client/src/components/form/__tests__/Input.test.tsx b/client/tests/components/form/__tests__/Input.test.tsx similarity index 92% rename from client/src/components/form/__tests__/Input.test.tsx rename to client/tests/components/form/__tests__/Input.test.tsx index 40625bab861..2f995f6197f 100644 --- a/client/src/components/form/__tests__/Input.test.tsx +++ b/client/tests/components/form/__tests__/Input.test.tsx @@ -2,11 +2,11 @@ require('jest'); import * as React from 'react'; import { shallow } from 'enzyme'; -import { NotEmpty } from '../Constraints'; -import FieldFeedbackPanel from '../FieldFeedbackPanel'; -import { IInputChangeHandler, IError, IConstraint } from '../../../types'; +import { NotEmpty } from '../../../../src/components/form/Constraints'; +import FieldFeedbackPanel from '../../../../src/components/form/FieldFeedbackPanel'; +import { IInputChangeHandler, IError, IConstraint } from '../../../../src/types'; -import Input from '../Input'; +import Input from '../../../../src/components/form/Input'; describe('Input', () => { diff --git a/client/tsconfig.json b/client/tsconfig.json index fb46eff02b6..1a88fc81f28 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json @@ -5,7 +5,7 @@ "noImplicitAny": false, "preserveConstEnums": true, "removeComments": true, - "target": "ES5", + "target": "ES6", "allowJs": true, "outDir": "public/dist", "sourceMap": true @@ -13,6 +13,7 @@ "exclude": [ "node_modules", "typings/browser.d.ts", - "typings/browser" + "typings/browser", + "tests" ] } diff --git a/client/typings.json b/client/typings.json index f82000f7e28..87bf313e7cf 100644 --- a/client/typings.json +++ b/client/typings.json @@ -1,14 +1,16 @@ { "globalDependencies": { "classnames": "registry:dt/classnames#0.0.0+20160316155526", + "enzyme": "registry:dt/enzyme#2.5.1+20161019142319", + "jest": "registry:dt/jest#15.1.1+20160919141445", "node": "registry:dt/node#6.0.0+20160921192128", + "react": "registry:dt/react#0.14.0+20161008064207", + "react-dom": "registry:dt/react-dom#0.14.0+20160412154040", "react-router/history": "registry:dt/react-router/history#2.0.0+20160830150755", "whatwg-fetch": "registry:dt/whatwg-fetch#0.0.0+20160829180742", "whatwg-streams": "registry:dt/whatwg-streams#0.0.0+20160829180742" }, "dependencies": { - "react": "registry:npm/react#15.0.1+20160601175240", - "react-dom": "registry:npm/react-dom#15.0.1+20160826174104", "react-router": "registry:npm/react-router#2.4.0+20160915183637" } }