package.json: reorganize test commands (#571)
Summary: Running `yarn test` (equiv. `npm test` or `npm run test`) now runs all checks. It takes the place of the former `yarn travis`. This is more in line with the expectation of a top-level `test` command: if it passes, your code is good. The `unit` command now runs Jest once, not in watch mode. It takes the place of the former `ci-test`. To run tests in watch mode, run any of the following: - `yarn unit --watch`, or - `npm run unit -- --watch`, or - `npm unit -- --watch`. This behavior is more consistent with the standard behavior of commands like `make test`. It is also empirically what @wchargin and @decentralion want most of the time. Test Plan: Verify that each of the scripts `test`, `unit`, and `coverage` passes. Verify that each of the aforementioned `--watch` invocations works. Verify that `.travis.yml` has the correct `script:` command. wchargin-branch: reorganize-test-command
This commit is contained in:
parent
c1cb29b1e6
commit
3b5ad594bd
|
@ -1,7 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- "node"
|
||||
script: yarn travis
|
||||
script: yarn test
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
|
|
|
@ -129,9 +129,9 @@ guide you through the architecture, and assign you to the relevant issue.
|
|||
* Follow the installation and setup instructions as above.
|
||||
|
||||
Once your changes are ready for test and review:
|
||||
* `yarn prettify`, which runs [prettier] to format your code
|
||||
* `yarn travis`
|
||||
* Submit your pull request
|
||||
* run `yarn prettify`, which runs [prettier] to format your code
|
||||
* run `yarn test`
|
||||
* submit your pull request
|
||||
|
||||
[prettier]: https://github.com/prettier/prettier
|
||||
[Discord]: https://discord.gg/tsBTgc9
|
||||
|
|
|
@ -53,8 +53,8 @@ function makeTasks(mode /*: "BASIC" | "FULL" */) {
|
|||
deps: [],
|
||||
},
|
||||
{
|
||||
id: "ci-test",
|
||||
cmd: ["npm", "run", "--silent", "ci-test"],
|
||||
id: "unit",
|
||||
cmd: ["npm", "run", "--silent", "unit"],
|
||||
deps: [],
|
||||
},
|
||||
{
|
|
@ -75,12 +75,11 @@
|
|||
"start": "NODE_ENV=development webpack-dev-server --config config/makeWebpackConfig.js",
|
||||
"build": "NODE_ENV=production webpack --config config/makeWebpackConfig.js",
|
||||
"backend": "node scripts/backend.js",
|
||||
"test": "node scripts/test.js --env=jsdom",
|
||||
"ci-test": "CI=1 npm run test",
|
||||
"coverage": "npm run test -- --coverage",
|
||||
"test": "node ./config/test.js",
|
||||
"unit": "BABEL_ENV=test NODE_ENV=test jest --env=jsdom",
|
||||
"coverage": "npm run unit -- --coverage",
|
||||
"flow": "flow",
|
||||
"lint": "eslint src config --max-warnings 0",
|
||||
"travis": "node ./config/travis.js"
|
||||
"lint": "eslint src config --max-warnings 0"
|
||||
},
|
||||
"license": "MIT",
|
||||
"jest": {
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
// @flow
|
||||
"use strict";
|
||||
|
||||
// Do this as the first thing so that any code reading it knows the right env.
|
||||
process.env.BABEL_ENV = "test";
|
||||
process.env.NODE_ENV = "test";
|
||||
process.env.PUBLIC_URL = "";
|
||||
|
||||
require("../src/tools/entry");
|
||||
|
||||
// Ensure environment variables are read.
|
||||
require("../config/env");
|
||||
|
||||
const jest = require("jest");
|
||||
const argv = process.argv.slice(2);
|
||||
|
||||
// Watch unless on CI or in coverage mode
|
||||
if (!process.env.CI && argv.indexOf("--coverage") < 0) {
|
||||
argv.push("--watch");
|
||||
}
|
||||
|
||||
jest.run(argv);
|
Loading…
Reference in New Issue