From 30a71a03be367375bbe283c87cbfa9565e6cde61 Mon Sep 17 00:00:00 2001 From: dschom Date: Wed, 29 Mar 2023 17:15:51 -0700 Subject: [PATCH] task(all): Remove ':' characters from npm targets Because: - A ':' character indicates that a script is globally available This Commit: - Converts : to - --- .circleci/create-lists.sh | 8 ++++---- docs/adr/0032-l10n-i18n-improvements.md | 2 +- packages/fortress/package.json | 6 +++--- packages/fxa-admin-panel/README.md | 12 ++++++------ packages/fxa-admin-panel/package.json | 16 ++++++++-------- packages/fxa-admin-server/README.md | 4 ++-- packages/fxa-admin-server/package.json | 18 +++++++++--------- packages/fxa-auth-client/package.json | 4 ++-- packages/fxa-auth-server/package.json | 16 ++++++++-------- packages/fxa-auth-server/scripts/test-ci.sh | 2 +- packages/fxa-content-server/package.json | 4 ++-- packages/fxa-customs-server/package.json | 4 ++-- packages/fxa-event-broker/README.md | 4 ++-- packages/fxa-event-broker/package.json | 14 +++++++------- packages/fxa-geodb/package.json | 4 ++-- packages/fxa-graphql-api/package.json | 14 +++++++------- packages/fxa-payments-server/README.md | 12 ++++++------ packages/fxa-payments-server/package.json | 18 +++++++++--------- packages/fxa-profile-server/package.json | 4 ++-- packages/fxa-react/package.json | 8 ++++---- packages/fxa-settings/README.md | 2 +- packages/fxa-settings/package.json | 16 ++++++++-------- packages/fxa-shared/package.json | 18 +++++++++--------- 23 files changed, 105 insertions(+), 105 deletions(-) diff --git a/.circleci/create-lists.sh b/.circleci/create-lists.sh index 9ed1738b65..4841ed9fd1 100755 --- a/.circleci/create-lists.sh +++ b/.circleci/create-lists.sh @@ -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 diff --git a/docs/adr/0032-l10n-i18n-improvements.md b/docs/adr/0032-l10n-i18n-improvements.md index 461dc4e1a7..471f05409f 100644 --- a/docs/adr/0032-l10n-i18n-improvements.md +++ b/docs/adr/0032-l10n-i18n-improvements.md @@ -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 diff --git a/packages/fortress/package.json b/packages/fortress/package.json index ae239b28c6..c9202588e1 100644 --- a/packages/fortress/package.json +++ b/packages/fortress/package.json @@ -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", diff --git a/packages/fxa-admin-panel/README.md b/packages/fxa-admin-panel/README.md index a7467f6254..74354a45fd 100644 --- a/packages/fxa-admin-panel/README.md +++ b/packages/fxa-admin-panel/README.md @@ -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. diff --git a/packages/fxa-admin-panel/package.json b/packages/fxa-admin-panel/package.json index 01d0e955c5..5c23996a12 100644 --- a/packages/fxa-admin-panel/package.json +++ b/packages/fxa-admin-panel/package.json @@ -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": [ diff --git a/packages/fxa-admin-server/README.md b/packages/fxa-admin-server/README.md index 430af38a84..431c3a730c 100644 --- a/packages/fxa-admin-server/README.md +++ b/packages/fxa-admin-server/README.md @@ -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 diff --git a/packages/fxa-admin-server/package.json b/packages/fxa-admin-server/package.json index 1071ee9798..902dc879f5 100644 --- a/packages/fxa-admin-server/package.json +++ b/packages/fxa-admin-server/package.json @@ -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": { diff --git a/packages/fxa-auth-client/package.json b/packages/fxa-auth-client/package.json index fde33b20fd..675eeea068 100644 --- a/packages/fxa-auth-client/package.json +++ b/packages/fxa-auth-client/package.json @@ -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", diff --git a/packages/fxa-auth-server/package.json b/packages/fxa-auth-server/package.json index 19a31b430c..dd1bb6991a 100644 --- a/packages/fxa-auth-server/package.json +++ b/packages/fxa-auth-server/package.json @@ -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": { diff --git a/packages/fxa-auth-server/scripts/test-ci.sh b/packages/fxa-auth-server/scripts/test-ci.sh index 84015aeba2..3a8a61f2ae 100755 --- a/packages/fxa-auth-server/scripts/test-ci.sh +++ b/packages/fxa-auth-server/scripts/test-ci.sh @@ -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 diff --git a/packages/fxa-content-server/package.json b/packages/fxa-content-server/package.json index a86a91b4ea..3c0a4d7724 100644 --- a/packages/fxa-content-server/package.json +++ b/packages/fxa-content-server/package.json @@ -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": { diff --git a/packages/fxa-customs-server/package.json b/packages/fxa-customs-server/package.json index 74247d8299..9f06629088 100644 --- a/packages/fxa-customs-server/package.json +++ b/packages/fxa-customs-server/package.json @@ -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" }, diff --git a/packages/fxa-event-broker/README.md b/packages/fxa-event-broker/README.md index a0b703127c..c6ec60d0f5 100644 --- a/packages/fxa-event-broker/README.md +++ b/packages/fxa-event-broker/README.md @@ -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 ``` diff --git a/packages/fxa-event-broker/package.json b/packages/fxa-event-broker/package.json index 6fd5bfc894..bd615221a0 100644 --- a/packages/fxa-event-broker/package.json +++ b/packages/fxa-event-broker/package.json @@ -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" diff --git a/packages/fxa-geodb/package.json b/packages/fxa-geodb/package.json index 1d7fb6c2c6..9211f01a49 100644 --- a/packages/fxa-geodb/package.json +++ b/packages/fxa-geodb/package.json @@ -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": { diff --git a/packages/fxa-graphql-api/package.json b/packages/fxa-graphql-api/package.json index d262e34fc9..7765719786 100644 --- a/packages/fxa-graphql-api/package.json +++ b/packages/fxa-graphql-api/package.json @@ -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": { diff --git a/packages/fxa-payments-server/README.md b/packages/fxa-payments-server/README.md index c2fe76744d..f84a5233d2 100644 --- a/packages/fxa-payments-server/README.md +++ b/packages/fxa-payments-server/README.md @@ -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`. diff --git a/packages/fxa-payments-server/package.json b/packages/fxa-payments-server/package.json index 09ccfe0de5..21bd4a50e7 100644 --- a/packages/fxa-payments-server/package.json +++ b/packages/fxa-payments-server/package.json @@ -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": { diff --git a/packages/fxa-profile-server/package.json b/packages/fxa-profile-server/package.json index 34643960af..f6c976cba5 100644 --- a/packages/fxa-profile-server/package.json +++ b/packages/fxa-profile-server/package.json @@ -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" }, diff --git a/packages/fxa-react/package.json b/packages/fxa-react/package.json index d0a8b8e882..ea8ca19e55 100644 --- a/packages/fxa-react/package.json +++ b/packages/fxa-react/package.json @@ -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": { diff --git a/packages/fxa-settings/README.md b/packages/fxa-settings/README.md index fa0e68460c..dfbe728fb5 100644 --- a/packages/fxa-settings/README.md +++ b/packages/fxa-settings/README.md @@ -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: diff --git a/packages/fxa-settings/package.json b/packages/fxa-settings/package.json index db4f95cdbc..befbe3eec4 100644 --- a/packages/fxa-settings/package.json +++ b/packages/fxa-settings/package.json @@ -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": { diff --git a/packages/fxa-shared/package.json b/packages/fxa-shared/package.json index 4f3f8bb9b7..40b9c9f2d7 100644 --- a/packages/fxa-shared/package.json +++ b/packages/fxa-shared/package.json @@ -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 '**'"