Skip to content

Commit

Permalink
initial sosia
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrowder65 committed Sep 28, 2019
1 parent a5fb83c commit 4e58143
Show file tree
Hide file tree
Showing 7 changed files with 584 additions and 10 deletions.
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"<rootDir>/test/config.js"
],
"transform": {
"^.+\\.js?$": "babel-jest"
"^.+\\.js?$": "babel-jest",
"^.+\\.md?$": "jest-raw-loader"
},
"coverageThreshold": {
"global": {
Expand All @@ -49,7 +50,8 @@
"lines": 100,
"statements": 100
}
}
},
"moduleFileExtensions": ["json", "js"]
},
"peerDependencies": {
"@material-ui/core": "3.9.2",
Expand All @@ -73,10 +75,14 @@
"jest": "24.4.0",
"jest-dom": "3.0.1",
"jest-localstorage-mock": "2.4.0",
"jest-raw-loader": "^1.0.1",
"react": "16.8.4",
"react-dom": "16.8.4",
"react-styleguidist": "9.0.4",
"react-testing-library": "6.0.0",
"sosia": "^1.2.5",
"sosia-markdown": "^1.1.1",
"sosia-puppeteer": "^1.1.0",
"webpack": "4.29.6"
},
"babelConfig": ".babelrc.js",
Expand Down
6 changes: 5 additions & 1 deletion src/Login.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
```js
### Login

This thing displays a login!

```jsx
<Login />
```
7 changes: 7 additions & 0 deletions src/__tests__/Login.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import React from "react";
import { render } from "../../test/test-utils";
import Login from "../Login";
import markdown from "../Login.md";

test("that it renders without issues", () => {
render(<Login />);
});

const scope = { MyComponent: Login };

describe("My Component", () => {
expect({ markdown, scope }).toMatchVisualSnapshot();
});
4 changes: 4 additions & 0 deletions src/__tests__/__image_snapshots__/Login.test-snap.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Login 1`] = `"95b7e9a60f7412c4a3be206900976b7871a1d89e"`;

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions test/config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
require("jest-dom/extend-expect");
require("babel-polyfill");
require("react-testing-library/cleanup-after-each");
const { configure, toMatchVisualSnapshot } = require("sosia");
const { PuppeteerBrowserTarget } = require("sosia-puppeteer");
const { MarkdownSource } = require("sosia-markdown");

expect.extend({ toMatchVisualSnapshot });
configure({
targets: {
"chrome-desktop": new PuppeteerBrowserTarget({
width: 1024,
height: 768,
}),
},
sources: {
documentation: new MarkdownSource(),
},
});
Loading

0 comments on commit 4e58143

Please sign in to comment.