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

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
caulagi committed Oct 24, 2018
1 parent 5e642f1 commit 41d212c
Show file tree
Hide file tree
Showing 8 changed files with 321 additions and 242 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
language: node_js
node_js:
- 8
- 10
cache:
yarn: true
directories:
- node_modules
before_install:
- curl -o- -L https://yarnpkg.com/install.sh | bash
- export PATH="$HOME/.yarn/bin:$PATH"
script:
- yarn run build
- yarn test
21 changes: 19 additions & 2 deletions bsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
{
"name": "reason-scripts",
"sources": ["src"],
"bs-dependencies": ["reason-react", "@glennsl/bs-jest", "bs-fetch"],
"bsc-flags": ["-bs-no-version-header", "-bs-super-errors"],
"sources": [
{
"dir": "src"
},
{
"dir": "src/__tests__",
"type": "dev"
}
],
"reason": {
"react-jsx": 2
},
Expand All @@ -10,5 +18,14 @@
"module": "commonjs",
"in-source": true
},
"bs-dependencies": [
"reason-react",
"bs-fetch"
],
"bs-dev-dependencies": [
"@glennsl/bs-jest",
"bs-jest-dom",
"bs-react-testing-library"
],
"suffix": ".bs.js"
}
5 changes: 0 additions & 5 deletions jest.config.js

This file was deleted.

14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,30 @@
"dependencies": {
"react": "^16.3.1",
"react-dom": "^16.3.1",
"reason-react": "^0.5.3",
"reason-scripts": "^1.0.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"pretest": "bsb -make-world",
"test": "react-scripts test",
"eject": "react-scripts eject",
"prepare": "npm link bs-platform"
},
"devDependencies": {
"@glennsl/bs-jest": "^0.4.4",
"bs-fetch": "^0.3.0",
"bs-jest-dom": "^1.0.0",
"bs-platform": "^4.0.6",
"bs-react-testing-library": "^0.4.0",
"jest-dom": "^2.1.0",
"react-testing-library": "^5.2.0",
"reason-react": "^0.5.3"
"react-testing-library": "^5.2.0"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"eslintConfig": {
"extends": "react-app"
}
]
}
15 changes: 15 additions & 0 deletions src/__tests__/app_test.re
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
open Jest;
open JestDom;
open ReactTestingLibrary;

describe("App on default load", () => {

test("shows project tagline", () => {
let message = "Fantasy bets";
<App message=message />
|> render
|> getByText(~matcher=`Str(message))
|> expect
|> toBeInTheDocument
});
});
8 changes: 0 additions & 8 deletions src/app_test.re

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.js

This file was deleted.

Loading

0 comments on commit 41d212c

Please sign in to comment.