Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

[#167163350] front end setup #1

Merged
merged 8 commits into from
Jul 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module.exports = {
"roots": [
"<rootDir>/src"
],
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"testEnvironment": "node",

// Setup Enzyme
"snapshotSerializers": ["enzyme-to-json/serializer"],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupEnzyme.ts",
"moduleNameMapper": {
"^.+\\.(css|less|scss)$": "babel-jest"
}
}
15 changes: 10 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,29 @@
"lint": "tslint --project ."
},
"devDependencies": {
"@types/jest": "^24.0.13",
"@types/enzyme": "^3.1.12",
"@types/enzyme-adapter-react-16": "^1.0.2",
"@types/jest": "^23.3.1",
"@types/node": "10.14.1",
"@types/react": "16.8.23",
"@types/react-dom": "16.8.4",
"@types/react-test-renderer": "^16.8.2",
"@types/reactstrap": "^8.0.1",
"danger": "^8.0.0",
"danger-plugin-digitalcitizenship": "*",
"enzyme": "^3.3.0",
"enzyme-adapter-react-16": "^1.1.1",
"enzyme-to-json": "^3.3.4",
"jest": "^23.4.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the downgrade?

"italia-tslint-rules": "*",
"jest": "24.7.1",
"parcel-bundler": "^1.12.3",
"prettier": "^1.12.1",
"react-test-renderer": "^16.8.6",
"rimraf": "^2.6.2",
"sass": "^1.22.4",
"ts-jest": "^24.0.2",
"ts-jest": "23.0.1",
"tslint": "^5.1.0",
"typescript": "3.5.3"
"typescript": "^3.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why the downgrade?

},
"dependencies": {
"@coreui/coreui": "^2.1.12",
Expand All @@ -46,7 +52,6 @@
"react-dom": "^16.8.6",
"react-router-config": "^5.0.1",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1",
"reactstrap": "^8.0.0"
}
}
9 changes: 4 additions & 5 deletions src/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { shallow } from "enzyme";
import * as React from "react";
import * as ReactDOM from "react-dom";
import { App } from "../App";

it("renders without crashing", () => {
const div = document.createElement("div");
ReactDOM.render(<App />, div);
ReactDOM.unmountComponentAtNode(div);
it("mounts without crashing", () => {
const wrapper = shallow(<App />);
wrapper.unmount();
});
5 changes: 0 additions & 5 deletions src/__tests__/index.test.ts

This file was deleted.

4 changes: 4 additions & 0 deletions src/setupEnzyme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { configure } from "enzyme";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is used only for testing, it shouldn't be under src, makes sense to have it at root level

import EnzymeAdapter from "enzyme-adapter-react-16";

configure({ adapter: new EnzymeAdapter() });
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"noImplicitAny": true,
"declaration": true,
"sourceMap": true,
"jsx": "preserve",
"jsx": "react",
"lib": [
"dom",
"dom.iterable",
Expand Down
Loading