This is an automated email from the ASF dual-hosted git repository.
garren pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb-fauxton.git
The following commit(s) were added to refs/heads/master by this push:
new 8d9dc7a Updated instructions (#997)
8d9dc7a is described below
commit 8d9dc7aed3db7b654a82cb6749b38677b9d17be5
Author: Antonio Maranhao <[email protected]>
AuthorDate: Mon Oct 16 03:28:38 2017 -0400
Updated instructions (#997)
---
code-layout.md | 15 +++++++++++----
readme.md | 3 ++-
tests.md | 40 ++++++++++------------------------------
3 files changed, 23 insertions(+), 35 deletions(-)
diff --git a/code-layout.md b/code-layout.md
index 7bb038a..3b974ea 100644
--- a/code-layout.md
+++ b/code-layout.md
@@ -10,7 +10,7 @@ the codebase to build it around
[React](https://facebook.github.io/react/). We'r
(unit-tested!) React components. Backbone models and collections are still
being used for server-side data retrieval
and storage as is URL routing, but the plan is to phase out all Backbone over
time.
-### React and Flux
+### React and the Flux pattern
You can read more about [React](https://facebook.github.io/react/) and
[Flux](https://facebook.github.io/flux/docs/overview.html)
on their sites, but a few quick words about both.
@@ -21,8 +21,9 @@ a *virtual DOM* to handle the re-rendering. The key decisions
to moving to React
ease of testing. Check out [this
page](https://facebook.github.io/react/docs/why-react.html) for a few more
remarks.
Flux is primarily a *pattern* for keeping your code organized over time. One
of its key ideas is to have *one-way
-communication* as shown in the [diagram
here](https://github.com/facebook/flux). Information flows
-like this:
+communication* as shown in the [diagram
here](https://github.com/facebook/flux).
+
+Note that Fauxton has no dependency with the Flux code as it implements its
own dispatcher and reduce stores. The information flows like this:
1. User clicks on something in a React component,
2. the component fires an action (in an `actions.js` file),
@@ -39,10 +40,16 @@ Here's a simple example: imagine if a user shrunk/expanded
the main sidebar, and
needed to know about it to make use of the new space. Maybe one was a graph
and needed to redraw for the extra space,
and maybe another component could switch from "basic" to "advanced" view or
something.
-With Flux, you can just publish the single event, then each store could listen
for it, change whatever data was needed
+With this pattern, you can just publish the single event, then each store
could listen for it, change whatever data was needed
internally, then notify any components that was listening: and they would then
have the choice to rerender or not,
based on what changed. This is basic "pub/sub": allowing you to keep code
loosely coupled, but still communicate.
+### Moving to Redux
+
+There are a few drawbacks in the implementation above though. For instance the
reduce stores rely on Backbone.
+
+For this reason and others, it's encouraged that new components use Redux
(https://github.com/reactjs/redux), which follows the same principles as Flux.
Additionally, use React Redux (https://github.com/reactjs/react-redux) to
easily connect a Redux store to your React components.
+
## Addons
Each bit of functionality is its own separate module or addon. Addons are
located in their own `app/addons/myaddon-name`
diff --git a/readme.md b/readme.md
index 95ca37e..545a4ca 100644
--- a/readme.md
+++ b/readme.md
@@ -28,7 +28,8 @@ Please note that [node.js](http://nodejs.org/) and npm is
required. Specifically
* `git branch --set-upstream-to=upstream/master master`
1. Download all dependencies: `npm install`
1. Make sure you have CouchDB installed.
- - Option 1 (**recommended**): Use `npm run docker:up` to start a Docker
container running CouchDB. You need to have
[Docker](https://docs.docker.com/engine/installation/) installed to use this
option.
+ - Option 1 (**recommended**): Use `npm run docker:up` to start a Docker
container running CouchDB with user `tester` and password `testerpass`.
+ - You need to have
[Docker](https://docs.docker.com/engine/installation/) installed to use this
option.
- Option 2: Follow instructions
[found here](http://couchdb.readthedocs.org/en/latest/install/index.html)
diff --git a/tests.md b/tests.md
index 762f1b5..e9033f0 100644
--- a/tests.md
+++ b/tests.md
@@ -1,42 +1,22 @@
# Tests
-Fauxton has both unit and end-to-end tests.
-
-Most unit tests are implemented with [Mocha](https://mochajs.org/) but we are
slowly transitioning to [Jest](https://facebook.github.io/jest/). New tests
should be implemented with Jest.
-
-End-to-end tests use [Nightwatch](http://nightwatchjs.org/) against Selenium.
+Fauxton has both **unit tests**, implemented with
[Jest](https://facebook.github.io/jest/), and **end-to-end tests** using
[Nightwatch](http://nightwatchjs.org/) against Selenium.
## Unit tests
-Use `npm run test` to execute both Mocha and Jest tests.
-
-### Mocha tests
-
-You can run the Mocha unit tests via the command line or your browser.
-
-**Command line**
-
- grunt test
-
-**Browser**
-
-Run `grunt test` at least once in order to generate `bundle.js` which is
required by the HTML page.
-
-Make sure the dev server is running, and enter the path (not URL) to your
`runner.html` file in your browser.
-
- file://path/to/couchdb-fauxton/test/runner.html
+To run all tests:
-Refreshing the URL will re-run the tests via PhantomJS and in the browser.
+ npm run test
+
+You can run only specific tests by providing a pattern or filename.
-### Jest tests
+E.g.: to run tests in the `filename.test.js` file:
-To run all tests:
+ npm run test -- filename.test.js
- npm run jest
-
-To run a single test:
+E.g.: to run tests under the `addons/cors` path:
- npm run jest -- filename.test.js
+ npm run test -- addons/cors
## End-to-end tests
@@ -77,7 +57,7 @@ your settings.json file. That defines an object of the
following form:
```javascript
// ...
-"nightwatch": {
+"nightwatch": {
// ...
"testBlacklist": {
"documents": ["*"],
--
To stop receiving notification emails like this one, please contact
['"[email protected]" <[email protected]>'].