зеркало из https://github.com/mozilla/fxa.git
Merge pull request #15111 from mozilla/FXA-7096
task(all): Remove ':' characters from npm targets
This commit is contained in:
Коммит
dd9db39ce4
|
@ -44,12 +44,12 @@ do
|
|||
genIncludeArgs $pkg compile ts-build-includes.list
|
||||
genIncludeArgs $pkg lint lint-includes.list
|
||||
genIncludeArgs $pkg postinstall postinstall-includes.list
|
||||
genIncludeArgs $pkg test:unit unit-test-includes.list
|
||||
genIncludeArgs $pkg test:integration integration-test-includes.list
|
||||
genIncludeArgs $pkg test-unit unit-test-includes.list
|
||||
genIncludeArgs $pkg test-integration integration-test-includes.list
|
||||
|
||||
# Creates a list of yarn workspace commands that can be run with gnu parallels.
|
||||
# This will ensure the script exists prior to generating the command.
|
||||
genWorkspaceCmd $pkg test:unit unit-test.list
|
||||
genWorkspaceCmd $pkg test:integration integration-test.list
|
||||
genWorkspaceCmd $pkg test-unit unit-test.list
|
||||
genWorkspaceCmd $pkg test-integration integration-test.list
|
||||
|
||||
done < .lists/test.list
|
||||
|
|
|
@ -34,7 +34,7 @@ Historically, we did not deploy our `en` or `en-US` Fluent bundles, but we have
|
|||
|
||||
`fxa-payments-server` commits a single file to [`public/locales/en-US/main.ftl`](https://github.com/mozilla/fxa/blob/main/packages/fxa-payments-server/public/locales/en-US/main.ftl) which is copied to the l10n repo. This differs from `fxa-settings` and `fxa-auth-server`, wherein we separate FTL files per component and then concatenate the files together to copy into the l10n repo.
|
||||
|
||||
For consistency, better maintainability, and because we need to set up concatenation anyway (see the `fxa-react` decision), we'll split `fxa-payments-server`'s FTL file into per-component `en.ftl` files. This will require setting up something similar to `fxa-auth-server`'s `merge-ftl:test` script for test, and we can make sure those reference the same relative path. We can also rename `main.ftl` to become `payments.ftl`.
|
||||
For consistency, better maintainability, and because we need to set up concatenation anyway (see the `fxa-react` decision), we'll split `fxa-payments-server`'s FTL file into per-component `en.ftl` files. This will require setting up something similar to `fxa-auth-server`'s `merge-ftl-test` script for test, and we can make sure those reference the same relative path. We can also rename `main.ftl` to become `payments.ftl`.
|
||||
|
||||
#### Negative consequences
|
||||
|
||||
|
|
|
@ -37,10 +37,10 @@
|
|||
"stylelint-config-prettier": "^9.0.3"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "npm-run-all --parallel lint:eslint",
|
||||
"lint": "npm-run-all --parallel lint-eslint",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint:eslint": "eslint .",
|
||||
"lint:style": "stylelint --config ../../_dev/.stylelintrc static/*.css",
|
||||
"lint-eslint": "eslint .",
|
||||
"lint-style": "stylelint --config ../../_dev/.stylelintrc static/*.css",
|
||||
"start": "pm2 start pm2.config.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
|
|
|
@ -53,23 +53,23 @@ See the [`fxa-react` section of the `fxa-settings` docs](https://github.com/mozi
|
|||
|
||||
This package uses [Jest](https://jestjs.io/) to test both the frontend and server. By default `yarn test` will run all test scripts:
|
||||
|
||||
- `yarn test:frontend` will test the React App frontend under `src/`
|
||||
- `yarn test:server` will test the Express server under `server/`
|
||||
- `yarn test-frontend` will test the React App frontend under `src/`
|
||||
- `yarn test-server` will test the Express server under `server/`
|
||||
|
||||
Test specific tests with the following commands:
|
||||
|
||||
```bash
|
||||
# Test frontend tests for the component AccountSearch
|
||||
yarn test:frontend AccountSearch
|
||||
yarn test-frontend AccountSearch
|
||||
|
||||
# Grep frontend tests for "displays the error"
|
||||
yarn test:frontend -t "displays the error"
|
||||
yarn test-frontend -t "displays the error"
|
||||
|
||||
# Test server tests for the file server/lib/csp
|
||||
yarn test:server server/lib/csp
|
||||
yarn test-server server/lib/csp
|
||||
|
||||
# Grep server tests for "simple server routes"
|
||||
yarn test:server -t "simple server routes"
|
||||
yarn test-server -t "simple server routes"
|
||||
```
|
||||
|
||||
Refer to Jest's [CLI documentation](https://jestjs.io/docs/en/cli) for more advanced test configuration.
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
"description": "FxA Admin Panel",
|
||||
"scripts": {
|
||||
"build-css": "tailwindcss -i ./src/styles/tailwind.css -o ./src/styles/tailwind.out.css --postcss",
|
||||
"build:client": "tsc --build ../fxa-react && tsc --build && NODE_ENV=production npm run build-css && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||
"build:server": "tsc -p server/tsconfig.json",
|
||||
"build": "npm-run-all build:client build:server",
|
||||
"build-client": "tsc --build ../fxa-react && tsc --build && NODE_ENV=production npm run build-css && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||
"build-server": "tsc -p server/tsconfig.json",
|
||||
"build": "npm-run-all build-client build-server",
|
||||
"compile": "tsc --noEmit",
|
||||
"eject": "react-scripts eject",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
|
@ -15,11 +15,11 @@
|
|||
"start": "tsc --build ../fxa-react && npm run build-css && pm2 start pm2.config.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test:frontend": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-frontend.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --coverage --verbose --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||
"test:server": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-server.xml jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||
"test": "CI=true npm-run-all test:frontend test:server",
|
||||
"test:unit": "yarn build-css && yarn build:client && yarn test",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name"
|
||||
"test-frontend": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-frontend.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --coverage --verbose --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||
"test-server": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-server.xml jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit --ci --reporters=default --reporters=jest-junit -t '^(?!.*#integration)'",
|
||||
"test": "CI=true npm-run-all test-frontend test-server",
|
||||
"test-unit": "yarn build-css && yarn build-client && yarn test",
|
||||
"test-integration": "echo No integration tests present for $npm_package_name"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -121,10 +121,10 @@ Test commands:
|
|||
|
||||
```bash
|
||||
# Test with coverage
|
||||
yarn test:cov
|
||||
yarn test-cov
|
||||
|
||||
# Test on file change
|
||||
yarn test:watch
|
||||
yarn test-watch
|
||||
```
|
||||
|
||||
## GraphQL Schema Generation
|
||||
|
|
|
@ -12,18 +12,18 @@
|
|||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"start": "yarn build && pm2 start pm2.config.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"start:prod": "node dist/main",
|
||||
"start-prod": "node dist/main",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "yarn gen-keys && yarn test:default && yarn test:e2e ",
|
||||
"test": "yarn gen-keys && yarn test-default && yarn test-e2e ",
|
||||
"gen-keys": "node -r esbuild-register ./scripts/gen_keys.ts;",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --runInBand --coverage --forceExit --logHeapUsage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:integration-disabled": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --runInBand --coverage --forceExit --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:default": "jest --runInBand --forceExit -t=\"scripts/audit-tokens\"",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --runInBand --config ./test/jest-e2e.json --forceExit",
|
||||
"test-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --runInBand --coverage --forceExit --logHeapUsage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-integration-disabled": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --runInBand --coverage --forceExit --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-default": "jest --runInBand --forceExit -t=\"scripts/audit-tokens\"",
|
||||
"test-watch": "jest --watch",
|
||||
"test-cov": "jest --coverage",
|
||||
"test-debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand",
|
||||
"test-e2e": "jest --runInBand --config ./test/jest-e2e.json --forceExit",
|
||||
"email-bounce": "node -r esbuild-register ./scripts/email-bounce.ts"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"ts-check": "tsc --noEmit",
|
||||
"test": "mocha -r esbuild-register test/*",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
"test:unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register test/*",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name"
|
||||
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register test/*",
|
||||
"test-integration": "echo No integration tests present for $npm_package_name"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MPL-2.0",
|
||||
|
|
|
@ -21,10 +21,10 @@
|
|||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "yarn merge-ftl:test && yarn emails-scss && VERIFIER_VERSION=0 scripts/test-local.sh",
|
||||
"test-ci": "yarn merge-ftl:test && scripts/test-local.sh && npm run test-e2e",
|
||||
"test:unit": "yarn merge-ftl:test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=unit scripts/test-ci.sh",
|
||||
"test:integration": "yarn merge-ftl:test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=integration scripts/test-ci.sh",
|
||||
"test": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 scripts/test-local.sh",
|
||||
"test-ci": "yarn merge-ftl-test && scripts/test-local.sh && npm run test-e2e",
|
||||
"test-unit": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=unit scripts/test-ci.sh",
|
||||
"test-integration": "yarn merge-ftl-test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=integration scripts/test-ci.sh",
|
||||
"test-e2e": "NODE_ENV=dev mocha -r esbuild-register test/e2e",
|
||||
"test-scripts": "NODE_ENV=dev mocha -r esbuild-register test/scripts --exit",
|
||||
"test-remote": "MAILER_HOST=restmail.net MAILER_PORT=80 CORS_ORIGIN=http://baz mocha -r esbuild-register --timeout=300000 test/remote",
|
||||
|
@ -40,12 +40,12 @@
|
|||
"remove-unverified-accounts": "CONFIG_FILES='config/secrets.json' node -r esbuild-register ./scripts/remove-unverified-accounts.ts",
|
||||
"emails-scss": "node -r esbuild-register ./lib/senders/emails/sass-compile-files.ts",
|
||||
"storybook": "yarn l10n-prime && npm run install-ejs && yarn emails-scss && NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6010 --no-version-updates -s ./",
|
||||
"build-storybook": "yarn l10n-prime && npm run install-ejs && yarn emails-scss && NODE_OPTIONS=--openssl-legacy-provider build-storybook && yarn build-storybook:copy-locales && yarn build-storybook:copy-templates",
|
||||
"build-storybook:copy-locales": "mkdir -p ./storybook-static/public/locales && cp -R ./public/locales ./storybook-static/public",
|
||||
"build-storybook:copy-templates": "mkdir -p ./storybook-static/lib/senders/emails/templates && cp -R ./lib/senders/emails ./storybook-static/lib/senders",
|
||||
"build-storybook": "yarn l10n-prime && npm run install-ejs && yarn emails-scss && NODE_OPTIONS=--openssl-legacy-provider build-storybook && yarn build-storybook-copy-locales && yarn build-storybook-copy-templates",
|
||||
"build-storybook-copy-locales": "mkdir -p ./storybook-static/public/locales && cp -R ./public/locales ./storybook-static/public",
|
||||
"build-storybook-copy-templates": "mkdir -p ./storybook-static/lib/senders/emails/templates && cp -R ./lib/senders/emails ./storybook-static/lib/senders",
|
||||
"install-ejs": "./scripts/install-ejs.sh",
|
||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl",
|
||||
"merge-ftl:test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"watch-ftl": "yarn grunt watch-ftl"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -17,7 +17,7 @@ node -r esbuild-register ./scripts/oauth_gen_keys.js
|
|||
echo 'Updating ftl files'
|
||||
# Migrate current strings
|
||||
yarn run merge-ftl
|
||||
yarn run merge-ftl:test
|
||||
yarn run merge-ftl-test
|
||||
|
||||
# Process sass for rendering of email templates
|
||||
echo
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
"test-pairing": "node tests/intern.js --suites=pairing",
|
||||
"test-pairing-circle": "node tests/intern.js --suites=pairing --fxaAuthRoot=https://fxaci.dev.lcip.org/auth --fxaEmailRoot=http://restmail.net --fxaOAuthApp=https://123done-fxaci.dev.lcip.org/ --fxaProduction=true --bailAfterFirstFailure=true",
|
||||
"test-server": "node tests/intern.js --suites=server",
|
||||
"test:unit": "echo No unit tests present for $npm_package_name",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name",
|
||||
"test-unit": "echo No unit tests present for $npm_package_name",
|
||||
"test-integration": "echo No integration tests present for $npm_package_name",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint": "eslint .",
|
||||
"test": "scripts/test-local.sh",
|
||||
"test:unit": "yarn make-artifacts-dir && tap test/local --jobs=1 | tap-xunit > ../../artifacts/tests/$npm_package_name/tap-unit.xml",
|
||||
"test:integration": "yarn make-artifacts-dir && tap test/remote test/scripts --jobs=1 | tap-xunit > ../../artifacts/tests/$npm_package_name/tap-integration.xml",
|
||||
"test-unit": "yarn make-artifacts-dir && tap test/local --jobs=1 | tap-xunit > ../../artifacts/tests/$npm_package_name/tap-unit.xml",
|
||||
"test-integration": "yarn make-artifacts-dir && tap test/remote test/scripts --jobs=1 | tap-xunit > ../../artifacts/tests/$npm_package_name/tap-integration.xml",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
"make-artifacts-dir": "mkdir -p ../../artifacts/tests/$npm_package_name"
|
||||
},
|
||||
|
|
|
@ -202,8 +202,8 @@ Test commands:
|
|||
|
||||
```bash
|
||||
# Test with coverage
|
||||
yarn test:cov
|
||||
yarn test-cov
|
||||
|
||||
# Test on file change
|
||||
yarn test:watch
|
||||
yarn test-watch
|
||||
```
|
||||
|
|
|
@ -9,15 +9,15 @@
|
|||
"compile": "tsc --noEmit",
|
||||
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||
"start": "../../_scripts/check-url.sh localhost:9000/__heartbeat__ && pm2 start pm2.config.js",
|
||||
"start:prod": "node dist/main",
|
||||
"start-prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --forceExit --detectOpenHandles --logHeapUsage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit ",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand",
|
||||
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||
"test-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --forceExit --detectOpenHandles --logHeapUsage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit ",
|
||||
"test-watch": "jest --watch",
|
||||
"test-cov": "jest --coverage",
|
||||
"test-debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand",
|
||||
"test-e2e": "jest --config ./test/jest-e2e.json",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js"
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha",
|
||||
"test:unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha --grep '#integration' --invert",
|
||||
"test:integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml mocha --grep '#integration'",
|
||||
"test-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha --grep '#integration' --invert",
|
||||
"test-integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml mocha --grep '#integration'",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --runInBand --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit && yarn test:e2e",
|
||||
"test": "jest --runInBand --logHeapUsage && yarn test:e2e",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand --logHeapUsage",
|
||||
"test:e2e": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-e2e.xml jest --runInBand --logHeapUsage --config ./test/jest-e2e.json --ci --reporters=default --reporters=jest-junit",
|
||||
"test-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --runInBand --logHeapUsage -t '#integration' --ci --reporters=default --reporters=jest-junit && yarn test-e2e",
|
||||
"test": "jest --runInBand --logHeapUsage && yarn test-e2e",
|
||||
"test-watch": "jest --watch",
|
||||
"test-cov": "jest --coverage",
|
||||
"test-debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand --logHeapUsage",
|
||||
"test-e2e": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-e2e.xml jest --runInBand --logHeapUsage --config ./test/jest-e2e.json --ci --reporters=default --reporters=jest-junit",
|
||||
"email-bounce": "node -r esbuild-register ./scripts/email-bounce.ts"
|
||||
},
|
||||
"repository": {
|
||||
|
|
|
@ -49,23 +49,23 @@ Use the following as a template, and fill in your own values:
|
|||
|
||||
This package uses [Jest](https://jestjs.io/) to test both the frontend and server. By default `yarn test` will run all yarn test scripts:
|
||||
|
||||
- `yarn test:frontend` will test the React App frontend under `src/`
|
||||
- `yarn test:server` will test the Express server under `server/`
|
||||
- `yarn test-frontend` will test the React App frontend under `src/`
|
||||
- `yarn test-server` will test the Express server under `server/`
|
||||
|
||||
Test specific tests with the following commands:
|
||||
|
||||
```bash
|
||||
# Test frontend tests for the component AlertBar
|
||||
yarn test:frontend AlertBar
|
||||
yarn test-frontend AlertBar
|
||||
|
||||
# Grep frontend tests for "renders as expected"
|
||||
yarn test:frontend -t "renders as expected"
|
||||
yarn test-frontend -t "renders as expected"
|
||||
|
||||
# Test server tests for the file server/lib/csp
|
||||
yarn test:server server/lib/csp
|
||||
yarn test-server server/lib/csp
|
||||
|
||||
# Grep server tests for "logs raw events"
|
||||
yarn test:server -t "logs raw events"
|
||||
yarn test-server -t "logs raw events"
|
||||
```
|
||||
|
||||
Note that prior to testing you may need to create a build of the React App. You can do this by running `yarn build`.
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
"clean": "git clean -fXd",
|
||||
"l10n-prime": "yarn l10n:prime fxa-payments-server",
|
||||
"l10n-bundle": "yarn l10n:bundle fxa-payments-server react,payments",
|
||||
"lint": "npm-run-all --parallel lint:eslint",
|
||||
"lint:eslint": "eslint . .storybook",
|
||||
"lint": "npm-run-all --parallel lint-eslint",
|
||||
"lint-eslint": "eslint . .storybook",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"start": "tsc --build ../fxa-react && npm run build-css && yarn merge-ftl && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:3031/__lbheartbeat__",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
|
@ -18,17 +18,17 @@
|
|||
"delete": "pm2 delete pm2.config.js",
|
||||
"build": "yarn merge-ftl && tsc --build ../fxa-react && NODE_ENV=production npm run build-css && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false CI=false NODE_OPTIONS=--openssl-legacy-provider rescripts build",
|
||||
"eject": "react-scripts eject",
|
||||
"test": "npm-run-all test:frontend test:server",
|
||||
"test:frontend": "yarn merge-ftl:test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false",
|
||||
"test:frontend:watch": "yarn merge-ftl:test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test",
|
||||
"test:server": "yarn merge-ftl:test && yarn build && jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit",
|
||||
"test:unit": "yarn build && yarn merge-ftl:test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:integration": "yarn build && yarn merge-ftl:test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false --ci --reporters=default --reporters=jest-junit",
|
||||
"test": "npm-run-all test-frontend test-server",
|
||||
"test-frontend": "yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false",
|
||||
"test-frontend-watch": "yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test",
|
||||
"test-server": "yarn merge-ftl-test && yarn build && jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit",
|
||||
"test-unit": "yarn build && yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-integration": "yarn build && yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --watchAll=false --ci --reporters=default --reporters=jest-junit",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
"storybook": "NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6006",
|
||||
"build-storybook": "NODE_ENV=production npm run build-css && NODE_OPTIONS=--openssl-legacy-provider build-storybook && cp -r public/images storybook-static/",
|
||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl && yarn l10n-bundle",
|
||||
"merge-ftl:test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"watch-ftl": "grunt watch-ftl"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "scripts/test-local.sh",
|
||||
"test:unit": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert",
|
||||
"test:integration": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration'",
|
||||
"test-unit": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' --invert",
|
||||
"test-integration": "yarn make-dirs && MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration'",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
"make-dirs": "mkdir -p var/public"
|
||||
},
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
"stop": "pm2 stop pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"storybook": "yarn merge-ftl && npm run build-css && NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6007 --no-version-updates",
|
||||
"test": "yarn merge-ftl:test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --env=jest-environment-jsdom -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit ",
|
||||
"test:unit": "yarn test",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name",
|
||||
"test": "yarn merge-ftl-test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --env=jest-environment-jsdom -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit ",
|
||||
"test-unit": "yarn test",
|
||||
"test-integration": "echo No integration tests present for $npm_package_name",
|
||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl",
|
||||
"merge-ftl:test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"watch-ftl": "grunt watch-ftl"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -514,7 +514,7 @@ All logging methods have the argument `eventProperties`, which can be used to su
|
|||
|
||||
## Testing and Mocks for Tests/Storybook
|
||||
|
||||
This package uses [Jest](https://jestjs.io/) to test its code. By default `yarn test` will test all JS files under `src/`. Running `yarn test:coverage` will also provide a coverage report, which should be respected.
|
||||
This package uses [Jest](https://jestjs.io/) to test its code. By default `yarn test` will test all JS files under `src/`. Running `yarn test-coverage` will also provide a coverage report, which should be respected.
|
||||
|
||||
Test specific tests with the following commands:
|
||||
|
||||
|
|
|
@ -13,20 +13,20 @@
|
|||
"l10n-prime": "yarn l10n:prime fxa-settings",
|
||||
"l10n-bundle": "yarn l10n:bundle fxa-settings branding,react,settings",
|
||||
"legal-clone": "yarn legal:clone fxa-settings",
|
||||
"lint:eslint": "eslint . .storybook",
|
||||
"lint": "npm-run-all --parallel lint:eslint",
|
||||
"lint-eslint": "eslint . .storybook",
|
||||
"lint": "npm-run-all --parallel lint-eslint",
|
||||
"restart": "npm run build-css && pm2 restart pm2.config.js",
|
||||
"start": "yarn merge-ftl && npm run build-css && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:3000/settings/static/js/bundle.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"storybook": "yarn legal-clone && STORYBOOK_BUILD=1 npm run build-css && NODE_OPTIONS=--openssl-legacy-provider start-storybook -p 6008 --no-version-updates",
|
||||
"test": "yarn legal-clone && yarn merge-ftl:test && SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false",
|
||||
"test:watch": "yarn legal-clone && yarn merge-ftl:test && SKIP_PREFLIGHT_CHECK=true rescripts test",
|
||||
"test:coverage": "yarn legal-clone && yarn test --coverage --watchAll=false",
|
||||
"test:unit": "echo No unit tests present for $npm_package_name",
|
||||
"test:integration": "yarn legal-clone && yarn merge-ftl:test && tsc --build ../fxa-react && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false --ci --runInBand --reporters=default --reporters=jest-junit",
|
||||
"test": "yarn legal-clone && yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false",
|
||||
"test-watch": "yarn legal-clone && yarn merge-ftl-test && SKIP_PREFLIGHT_CHECK=true rescripts test",
|
||||
"test-coverage": "yarn legal-clone && yarn test --coverage --watchAll=false",
|
||||
"test-unit": "echo No unit tests present for $npm_package_name",
|
||||
"test-integration": "yarn legal-clone && yarn merge-ftl-test && tsc --build ../fxa-react && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false --ci --runInBand --reporters=default --reporters=jest-junit",
|
||||
"merge-ftl": "yarn l10n-prime && grunt merge-ftl && yarn l10n-bundle",
|
||||
"merge-ftl:test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"merge-ftl-test": "yarn l10n-prime && grunt merge-ftl:test",
|
||||
"watch-ftl": "grunt watch-ftl"
|
||||
},
|
||||
"jest": {
|
||||
|
|
|
@ -62,15 +62,15 @@
|
|||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "yarn test:mocha && yarn test:jest",
|
||||
"test:unit": "yarn test:mocha:unit && yarn test:jest:unit",
|
||||
"test:integration": "yarn test:mocha:integration && yarn test:jest:integration",
|
||||
"test:mocha": "tsc --build && node ./scripts/mocha-coverage.js -r esbuild-register --recursive test/**/*.{js,ts}",
|
||||
"test:mocha:unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#integration' --invert",
|
||||
"test:mocha:integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#integration'",
|
||||
"test:jest": "jest --runInBand --logHeapUsage --coverage",
|
||||
"test:jest:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --forceExit --coverage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:jest:integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --runInBand --logHeapUsage --coverage -t '#integration' --ci --reporters=default --reporters=jest-junit",
|
||||
"test": "yarn test-mocha && yarn test-jest",
|
||||
"test-unit": "yarn test-mocha-unit && yarn test-jest-unit",
|
||||
"test-integration": "yarn test-mocha-integration && yarn test-jest-integration",
|
||||
"test-mocha": "tsc --build && node ./scripts/mocha-coverage.js -r esbuild-register --recursive test/**/*.{js,ts}",
|
||||
"test-mocha-unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#integration' --invert",
|
||||
"test-mocha-integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#integration'",
|
||||
"test-jest": "jest --runInBand --logHeapUsage --coverage",
|
||||
"test-jest-unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --forceExit --coverage -t '^(?!.*?#integration).*' --ci --reporters=default --reporters=jest-junit",
|
||||
"test-jest-integration": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml jest --coverage --runInBand --logHeapUsage --coverage -t '#integration' --ci --reporters=default --reporters=jest-junit",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
|
|
Загрузка…
Ссылка в новой задаче