Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 41d212c

Browse files
committed
Fix tests
* Remove eslintConfig from package.json - see facebook/create-react-app#649 * Use latest version of yarn * Tidy packages - reason-react is a dependency, not dev-dependency * Need to run bsb -make-world before running tests * No need to run build before test
1 parent 5e642f1 commit 41d212c

File tree

8 files changed

+321
-242
lines changed

8 files changed

+321
-242
lines changed

.travis.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
language: node_js
22
node_js:
33
- 8
4+
- 10
45
cache:
6+
yarn: true
57
directories:
68
- node_modules
9+
before_install:
10+
- curl -o- -L https://yarnpkg.com/install.sh | bash
11+
- export PATH="$HOME/.yarn/bin:$PATH"
712
script:
8-
- yarn run build
913
- yarn test

bsconfig.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
{
22
"name": "reason-scripts",
3-
"sources": ["src"],
4-
"bs-dependencies": ["reason-react", "@glennsl/bs-jest", "bs-fetch"],
3+
"bsc-flags": ["-bs-no-version-header", "-bs-super-errors"],
4+
"sources": [
5+
{
6+
"dir": "src"
7+
},
8+
{
9+
"dir": "src/__tests__",
10+
"type": "dev"
11+
}
12+
],
513
"reason": {
614
"react-jsx": 2
715
},
@@ -10,5 +18,14 @@
1018
"module": "commonjs",
1119
"in-source": true
1220
},
21+
"bs-dependencies": [
22+
"reason-react",
23+
"bs-fetch"
24+
],
25+
"bs-dev-dependencies": [
26+
"@glennsl/bs-jest",
27+
"bs-jest-dom",
28+
"bs-react-testing-library"
29+
],
1330
"suffix": ".bs.js"
1431
}

jest.config.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
"dependencies": {
66
"react": "^16.3.1",
77
"react-dom": "^16.3.1",
8+
"reason-react": "^0.5.3",
89
"reason-scripts": "^1.0.0"
910
},
1011
"scripts": {
1112
"start": "react-scripts start",
1213
"build": "react-scripts build",
13-
"test": "react-scripts test --env=jsdom",
14+
"pretest": "bsb -make-world",
15+
"test": "react-scripts test",
1416
"eject": "react-scripts eject",
1517
"prepare": "npm link bs-platform"
1618
},
1719
"devDependencies": {
1820
"@glennsl/bs-jest": "^0.4.4",
1921
"bs-fetch": "^0.3.0",
22+
"bs-jest-dom": "^1.0.0",
2023
"bs-platform": "^4.0.6",
24+
"bs-react-testing-library": "^0.4.0",
2125
"jest-dom": "^2.1.0",
22-
"react-testing-library": "^5.2.0",
23-
"reason-react": "^0.5.3"
26+
"react-testing-library": "^5.2.0"
2427
},
2528
"browserslist": [
2629
">0.2%",
2730
"not dead",
2831
"not ie <= 11",
2932
"not op_mini all"
30-
],
31-
"eslintConfig": {
32-
"extends": "react-app"
33-
}
33+
]
3434
}

src/__tests__/app_test.re

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
open Jest;
2+
open JestDom;
3+
open ReactTestingLibrary;
4+
5+
describe("App on default load", () => {
6+
7+
test("shows project tagline", () => {
8+
let message = "Fantasy bets";
9+
<App message=message />
10+
|> render
11+
|> getByText(~matcher=`Str(message))
12+
|> expect
13+
|> toBeInTheDocument
14+
});
15+
});

src/app_test.re

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/setupTests.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)