Commands
Developing
Set NODE_ENV=development
in your .env
file.
npm run start [-- --open]
Builds and serves your application with hot reloading and debugging support.
Production build
npm run build
Creates bundles and assets into the /src/static
directory. Reads .env
but uses production Webpack configuration.
Start the server
Set NODE_ENV=production
in your .env
file.
npm start
Expects bundles and assets to exist in the /src/static
directory. Runs the server in production mode.
Or, use true environmental variables in your environment. Do not track the .env
in source control.
Unit test development server
npm run test:server
Start a test server using Mocha and Webpack-middleware. Provides a browser based testing environment. Load files within ./src
with an extension of .test.js
. If you want, change the .test.js
extension from within the ./src/config/webpack.unit-test.browser.config.js
file.
entry: {
main: [
// change the glob here
...glob.sync('./src/**/*.test.js').map(file =>
`mocha!${path.join(ROOT, file)}`
),
]
}
Unit test single run
npm run test:unit
Runs the test suite in a node environment through mocha, once. This command uses mocha which includes a --watch
feature to watch for test changes. This command watches files matching src/**/*.test.js
-- change this glob in /scripts/test/unit.sh
.
Functional/integration tests run
npm run test:func
The purpose of the functional (integration) tests is to sit between unit tests and acceptance (browser) tests. They're for testing groups of units, and how they communicate. These tests have a loose-coupling to code implementation.
For example, create specific tests for connections to IO. For example, if it's desired to test wiring between a DB or an external API. But, Breko-hub doesn't use either of these.
Run the functional and unit tests
npm run test
Linting
npm run lint
npm run lint:styles
No semi-colons and commas on multi-lines for easy duplication. Single-quotes and ticks instead of double-quotes. The eslint rule "no-unexpected-multiline" protects against any "no comma" issues.
The linting setup for SCSS uses defaults for the majority of rules. CSS modules makes the other rules irrelevant.
Coverage
npm run coverage
This generates a report based on the istanbul.yml configuration.
npm run coverage:check
Use this command when you want to error based on configured thresholds.