Verify breaking news online.
This is the web client of Check.
- Node.js (tested with version 6.9.2) and NPM modules as defined in package.json
- Ruby and RubyGems (to run the tests)
- Optional: Inkscape and ImageMagick (to generate the favicon)
If you are just getting started, you probably want to install the full Check stack with Docker.
The full Check environment will install Node packages into an invisible
node_modules/
directory. Instead of using npm run ...
, run
docker-compose exec web npm run ...
to run in the Docker container: the
Docker container can see the node_modules/
directory.
The dev-mode Docker container will watch for file changes in src/
and rebuild
whenever a file changes. It will output a message (success or error) after each
rebuild.
Translations are managed in Transifex.
All the contents are stored in the localization
directory which contains the
following subfolders:
localization/react-intl
: files extracted bybabel-plugin-react-intl
(localizable strings)localization/transifex
: files above, but converted to Transifex JSON formatlocalization/translations
: files downloaded from Transifex in JavaScript format
The application is displayed in the browser's language using the files from the
localization
directory.
Copy config-build.js.example
to config-build.js
(if you don't have it yet) and
add your Transifex user and password.
Then you can use npm run transifex:upload
and npm run transifex:download
to
upload and download translations, respectively.
Run docker-compose exec web npm install [--save-dev] MODULE [...]
. This will
overwrite package-lock.json
. Commit and deploy package-lock.json
alongside
any change to package.json
.
(For Meedan employees.) If:
- You are a member of the Meedan npmjs org; and
- You mean to install a fork of a buggy JavaScript module -- or a new module
Then publish it to npm. Name the module @meedan/name-of-my-module
(in its
package.json
) and then npm publish
. After, you may
docker-compose exec web npm install [--save-dev] MODULE
to use it in check-web
.
Running
- Start the test environment in the check repo:
docker-compose -f docker-compose.yml -f docker-test.yml up
- Copy
test/config.yml.example
totest/config.yml
and set the configurations - Copy
test/config.js.example
totest/config.js
and set the configurations - Run
docker-compose exec web npm test:integration
Writing
- Use API calls (instead of using Selenium) to create all test data you need before the real thing that the test is testing
- Tag the test with one of the existing tags
- Run
docker-compose exec web npm run test:unit
If you don't have time to implement an integration test for your feature, please add a pending test for that, like this:
it "should do whatever my feature expects" do
skip("Needs to be implemented")
end
In order to implement a pending unit test, do this:
it("should do whatever my unit expects");
- Remove your
node_modules
directory if you face errors related tonpm install