npm startThe site (both frontend resources and backend API) will be available at http://localhost:5000/. The frontend will automatically rebuild if changed, but the backend will not (looking for a good Rollup HMR plugin!)
By default, this will run a mock Google authentication provider and an in-memory database. To enable real authentication providers (e.g. Google sign in) and data persistence, see the services documentation.
Run all tests:
npm testnpm run test:frontendWatch mode:
npm run test:frontend:watchnpm run test:backendTo automatically build and run the server, and run tests against it:
npm run test:e2eDuring development, the build time can be significant. An alternative
is to run the application in the background in watch mode using
npm start -- --mock-sso (this differs from npm start because it
uses a mock Google single-sign-on endpoint even if you have configured
a real client ID), then run the end-to-end tests against that
deployment:
TARGET_HOST=http://localhost:5000/ MODE=dev npm run test:e2e(MODE=dev disables the download time test, as the site is much
larger when built in dev mode via npm start)
Run end-to-end tests with non-headless browsers:
HEADLESS=false npm run test:e2eThe server logs generated during the end-to-end test run are written
to e2e/build/app.log.
npm run buildThe output will be placed in build. Specify the PORT environment
variable when running (defaults to 5000):
cd build
npm install --omit=dev
PORT=8080 ./index.jsBy default, no sign on services will be available. To use the Refacto Local Testing accounts, specify:
SSO_GOOGLE_CLIENT_ID='199202234207-la0v05druske1f1qoimg3sgkpua2nvc7.apps.googleusercontent.com' \
SSO_GITLAB_CLIENT_ID='e4f936ea33a9b725e8c210fb72fd46ebd9688a46b975e5a8d40c79734e9fc00e' \
./index.jsThis client ID is configured for use on localhost on ports 80, 443, 8080,
8443, and 5000. The client secret is not required, as Refacto does not access
any personal data.
See the services documentation for details on setting up a database and integrating with authentication providers.
See the security documentation for additional considerations when running in production.
Add dependencies within the backend, frontend or e2e directories;
not in the root of the project.
Remember that runtime dependencies should be installed with --save,
and build / test dependencies should be installed with --save-dev.
cd frontend
npm install --save react
npm install --save-dev jestcd backend
npm install --save express
npm install --save-dev supertestcd e2e
npm install --save-dev selenium-webdriverThe latest versions of Google Chrome and Mozilla Firefox are supported, and the end-to-end tests will run in both (see Running tests).
- React: https://reactjs.org/docs/react-api.html
update: https://github.com/davidje13/json-immutability-helper- Wouter: https://github.com/molefrog/wouter
- Jest: https://jestjs.io/docs/en/api
- Flexible Testing Library React https://github.com/davidje13/flexible-testing-library-react
- Jest DOM Matchers https://github.com/testing-library/jest-dom
- Supertest: https://github.com/visionmedia/supertest and https://visionmedia.github.io/superagent/
- Selenium: https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/