зеркало из https://github.com/mozilla/fxa.git
task(CI): build, unit test, and integration test jobs
Because: - We wanted to run a few preliminary checks before proceeding to more expensive CI jobs. Checks include: - Compiling typescript in commonly referenced workspace packages - Linting code that has changed - Executing Unit Tests for code that has changed - We wanted to partition test operations into unit tests, and integration tests. Unit tests can be run relatively quickly and require no additional infrastructure. Integration tests require additional infrastructure and generally have longer execution times. Now that jobs are blocked from running until preliminary checks pass, one of which is unit tests, it is important to draw a distinction between these two types of tests. - We want to avoid unnecessary yarn installs and typescript compilations, which are time consuming. - We want to make sure that test results are published and failing tests can be easily viewed in the CI. This Commit: - Creates a build-and-validate job in the CI that builds, lints, and unit tests code prior to running any other jobs. - Creates unit-test job in CI config - Creates integration-test job in CI config - Removes redundant calls to compile workspace packages. These are now built up front, cached, and restored as needed for future runs. - Extends the create-lists script functionality to generate commands that can be executed with the parallel command. - Removes unnecessary yarn install operations. Invoking yarn workspace focus results in a yarn install. In the case of running tests this is largely unnecessary, because we already do a yarn install in the base-install step. - Make sure test results are exported as junit xml so the CI can report back on tests that were failing. This was done for a couple workspace packages, but many were lacking the capability. All test:unit and test:integration npm scripts now export this data. - Fixes the following issues encountered along the way: - Adds logs to monitor heap usage of jest tests. Some jest tests are still using a lot of memory. - Moves a few slow / long running tests from unit test to integration tests. - Ensures that jest.transform for ts-jest is always instructed to have the config option isolateModules is set to true. This definitely decreases memory overhead and resolves some of the OOM errors we were hitting. It was configured in some places but not everywhere. - Exports test results files for all tests - Exports all test artifacts - Uses gnu parallel to run tests in parallel. Turns out yarn workspaces foreach would give a false positive when an OOM was encountered. Fortunately, the parallel command offered an acceptable work around, and even offers some nice features like the load argument, which allows to control test execution a bit more efficiently.
This commit is contained in:
Родитель
43c0f441c5
Коммит
a620922422
|
@ -3,7 +3,8 @@
|
|||
echo "Running base install!"
|
||||
echo " . Base commit reference: $(cat base_ref)"
|
||||
echo " . Current commit reference: $(git rev-parse HEAD)"
|
||||
echo " . Force yarn install: $FORCE_YARN_INSTALL \n"
|
||||
echo " . Force yarn install: $FORCE_YARN_INSTALL"
|
||||
echo -e '\n\n'
|
||||
|
||||
# Only run yarn install if there are changes in the lock file or the env, FORCE_YARN_INSTALL,
|
||||
# indicates a yarn install must be run. The file yarn.lock.base as well as node_modules and
|
||||
|
@ -11,19 +12,26 @@ echo " . Force yarn install: $FORCE_YARN_INSTALL \n"
|
|||
# of the main branch. If there is no change to the lock file, there is no point in rebuilding,
|
||||
# and we can use the last known good state.
|
||||
|
||||
if $FORCE_YARN_INSTALL == 'true'; then
|
||||
if [[ $FORCE_YARN_INSTALL == 'true' ]]; then
|
||||
|
||||
# This is just here as safety net, in case we encounter an issue with base image state and
|
||||
# need to force an install.
|
||||
echo 'Forcing yarn install because FORCE_YARN_INSTALL == true.'
|
||||
echo -e '\n\n'
|
||||
set -x
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --immutable --inline-builds;
|
||||
|
||||
elif ! cmp --silent yarn.lock yarn.lock.base; then
|
||||
echo 'Changes detected on yarn.lock!'
|
||||
echo 'Note that pipelines execute faster if we can skip the yarn install step'
|
||||
echo 'which is possible when lock files are in sync with latest build from main.\n'
|
||||
echo 'Please consider rebasing on main, it may improve CI run times times!\n'
|
||||
echo '=============================================================================='
|
||||
echo 'IMPORTANT! Changes detected on yarn.lock.'
|
||||
echo '------------------------------------------------------------------------------'
|
||||
echo 'Note that pipelines execute faster if we can skip the yarn install step.'
|
||||
echo 'This is possible when lock files are in sync with latest build from main.'
|
||||
echo 'If there is no direct reason why the lockfile should change, please consider'
|
||||
echo 'rebasing on main, it may improve CI run times!'
|
||||
echo '=============================================================================='
|
||||
echo -e '\n\n'
|
||||
|
||||
|
||||
# There are a couple tricks here:
|
||||
# 1. Skip playwright browser install. We can do this because it's already been done in the base image. Installing
|
||||
|
@ -34,7 +42,13 @@ elif ! cmp --silent yarn.lock yarn.lock.base; then
|
|||
set -x
|
||||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 yarn install --immutable --inline-builds;
|
||||
else
|
||||
echo 'No changes detected on yarn.lock! Skipping yarn install and running postinstall directly.\n'
|
||||
echo '=============================================================================='
|
||||
echo 'Congrats! No changes detected on yarn.lock.'
|
||||
echo '------------------------------------------------------------------------------'
|
||||
echo 'Skipping yarn install and running postinstall directly.\n'
|
||||
echo '=============================================================================='
|
||||
echo -e '\n\n'
|
||||
|
||||
|
||||
# If we skip the yarn install, postinstall may still be needed on any workspace that have changed
|
||||
# since the base docker image was built.
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#/bin/bash -ex
|
||||
|
||||
LIST=".lists/ts-build-includes.list"
|
||||
|
||||
if [[ ! -f $LIST ]]; then
|
||||
echo "List isn't a valid file: $LIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yarn workspaces foreach \
|
||||
-piv \
|
||||
--topological-dev \
|
||||
$(cat $LIST) \
|
||||
run compile;
|
|
@ -10,6 +10,11 @@ orbs:
|
|||
jira: circleci/jira@1.3.1
|
||||
|
||||
executors:
|
||||
# Default node executor with low resources. Useful for running quick / small tasks
|
||||
tiny-executor:
|
||||
resource_class: small
|
||||
docker:
|
||||
- image: cimg/node:16.13
|
||||
|
||||
# For creating docker builds
|
||||
docker-build-executor:
|
||||
|
@ -50,7 +55,7 @@ executors:
|
|||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium+
|
||||
default: large
|
||||
resource_class: << parameters.resource_class >>
|
||||
docker:
|
||||
- image: << pipeline.parameters.docker-repo >>:ci-base-latest
|
||||
|
@ -69,7 +74,7 @@ executors:
|
|||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: xlarge
|
||||
default: large
|
||||
resource_class: << parameters.resource_class >>
|
||||
docker:
|
||||
- image: << pipeline.parameters.docker-repo >>:ci-base-browsers-latest
|
||||
|
@ -95,14 +100,13 @@ executors:
|
|||
smoke-test-executor:
|
||||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium+
|
||||
type: string
|
||||
default: medium+
|
||||
resource_class: << parameters.resource_class >>
|
||||
docker:
|
||||
- image: << pipeline.parameters.docker-repo >>:ci-base-browsers-latest
|
||||
|
||||
commands:
|
||||
|
||||
# Note: Cloning this way allows us to run a git fetch later on download the road. This type of
|
||||
# clone operation will result in a .git/config with no user attached that is using a
|
||||
# https://github.com/mozilla/fxa for the remote origin.
|
||||
|
@ -116,20 +120,42 @@ commands:
|
|||
# to a circleci `- checkout` command.
|
||||
git-checkout:
|
||||
steps:
|
||||
- run: git fetch
|
||||
- run: git checkout << pipeline.git.revision >>
|
||||
- run:
|
||||
name: Checkout Branch
|
||||
command: |
|
||||
set +x
|
||||
git fetch
|
||||
git checkout << pipeline.git.revision >>
|
||||
commitsBehind=$(git rev-list --left-only --count main...HEAD);
|
||||
if [[ $((commitsBehind)) > 0 ]]; then
|
||||
|
||||
if [[ $((commitsBehind)) == 1 ]]; then commits="commit"; else commits="commits"; fi;
|
||||
|
||||
echo -e '\n\n'
|
||||
echo '=============================================================================='
|
||||
echo "WARNING! Your branch is $commitsBehind $commits behind master!"
|
||||
echo '------------------------------------------------------------------------------'
|
||||
echo 'Please consider rebasing. By not rebasing you always run the risk of'
|
||||
echo 'introducing a breaking change into main!'
|
||||
echo '=============================================================================='
|
||||
echo -e '\n\n'
|
||||
fi
|
||||
|
||||
# Note: We no longer cache in step. As long as packages used in the branch aren't that different
|
||||
# from the packages used in main, which is generally the case, we shouldn't see large install
|
||||
# times, since the base image will have everything cached.
|
||||
provision:
|
||||
steps:
|
||||
- run: ./.circleci/base-install.sh
|
||||
- run: node .circleci/modules-to-test.js | tee packages/test.list
|
||||
- run: ./_scripts/create-version-json.sh
|
||||
- run: ./_scripts/compile-backend-ts-services.sh
|
||||
- run:
|
||||
name: Base Install
|
||||
command: |
|
||||
./.circleci/base-install.sh;
|
||||
./.circleci/create-lists.sh
|
||||
./_scripts/create-version-json.sh
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
path: ./packages/version.json
|
||||
- store_artifacts:
|
||||
path: ./.lists
|
||||
|
||||
cache-save-yarn:
|
||||
steps:
|
||||
|
@ -151,13 +177,12 @@ commands:
|
|||
parameters:
|
||||
index:
|
||||
type: integer
|
||||
default: 0
|
||||
total:
|
||||
type: integer
|
||||
default: 3
|
||||
steps:
|
||||
- git-checkout
|
||||
- provision
|
||||
- ts-build-restore
|
||||
- wait-for-infrastructure
|
||||
- run:
|
||||
name: Running test section << parameters.index >> of << parameters.total >>
|
||||
|
@ -165,14 +190,7 @@ commands:
|
|||
CIRCLE_NODE_INDEX: << parameters.index >>
|
||||
CIRCLE_NODE_TOTAL: << parameters.total >>
|
||||
command: ./.circleci/test-package.sh fxa-content-server
|
||||
- store_artifacts:
|
||||
path: ~/.pm2/logs
|
||||
destination: logs
|
||||
- store_artifacts:
|
||||
path: ~/screenshots
|
||||
destination: screenshots
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- store-artifacts
|
||||
|
||||
test-content-server-remote-part:
|
||||
parameters:
|
||||
|
@ -183,43 +201,115 @@ commands:
|
|||
steps:
|
||||
- git-checkout
|
||||
- provision
|
||||
- ts-build
|
||||
- run:
|
||||
name: Running test section << parameters.index >> of << parameters.total >>
|
||||
environment:
|
||||
CIRCLE_NODE_INDEX: << parameters.index >>
|
||||
CIRCLE_NODE_TOTAL: << parameters.total >>
|
||||
command: ./packages/fxa-content-server/scripts/test-ci-remote.sh
|
||||
- store_artifacts:
|
||||
path: ~/.pm2/logs
|
||||
destination: logs
|
||||
- store_artifacts:
|
||||
path: ~/screenshots
|
||||
destination: screenshots
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- store-artifacts
|
||||
|
||||
test-settings-server:
|
||||
steps:
|
||||
- run:
|
||||
name: Running test...
|
||||
command: ./.circleci/test-package.sh fxa-settings
|
||||
- store_artifacts:
|
||||
path: ~/.pm2/logs
|
||||
destination: logs
|
||||
- store_artifacts:
|
||||
path: ~/screenshots
|
||||
destination: screenshots
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- store-artifacts
|
||||
|
||||
wait-for-infrastructure:
|
||||
steps:
|
||||
- run:
|
||||
name: Wait for MySQL DB
|
||||
command: ./_scripts/check-mysql.sh
|
||||
- run:
|
||||
name: Run DB migrations
|
||||
command: node ./packages/db-migrations/bin/patcher.mjs;
|
||||
- run:
|
||||
name: Wait for firestore
|
||||
command: ./_scripts/check-url.sh localhost:9090;
|
||||
|
||||
lint:
|
||||
steps:
|
||||
- run:
|
||||
name: Linting
|
||||
command: ./.circleci/lint-packages.sh
|
||||
|
||||
# Not currently used. But should be soon once coverage reports are fixed up.
|
||||
report-coverage:
|
||||
parameters:
|
||||
list:
|
||||
type: string
|
||||
default: ''
|
||||
steps:
|
||||
- run:
|
||||
command: ./.circleci/report-coverage.sh << parameters.list >>
|
||||
|
||||
store-artifacts:
|
||||
steps:
|
||||
- run:
|
||||
name: Ensure directories
|
||||
command: mkdir -p artifacts/tests && mkdir -p ~/.pm2/logs && mkdir -p ~/screenshots
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
- store_artifacts:
|
||||
path: ~/screenshots
|
||||
- store_artifacts:
|
||||
path: ~/.pm2/logs
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
|
||||
ts-build:
|
||||
steps:
|
||||
- run:
|
||||
name: Build Common Typescript Packages
|
||||
command: ./.circleci/build-ts-packages.sh
|
||||
- save_cache:
|
||||
name: Save Typescript Build
|
||||
key: fxa-ts-build-01-<< pipeline.git.revision >>
|
||||
paths:
|
||||
- /home/circleci/project/packages/fxa-admin-server/dist
|
||||
- /home/circleci/project/packages/fxa-auth-client/dist
|
||||
- /home/circleci/project/packages/fxa-auth-server/dist
|
||||
- /home/circleci/project/packages/fxa-event-broker/dist
|
||||
- /home/circleci/project/packages/fxa-graphql-api/dist
|
||||
- /home/circleci/project/packages/fxa-react/dist
|
||||
- /home/circleci/project/packages/fxa-shared/dist
|
||||
- /home/circleci/project/packages/fxa-support-panel/dist
|
||||
|
||||
ts-build-restore:
|
||||
steps:
|
||||
- restore_cache:
|
||||
keys:
|
||||
- fxa-ts-build-01-<< pipeline.git.revision >>
|
||||
|
||||
run-tests:
|
||||
parameters:
|
||||
test_name:
|
||||
type: string
|
||||
# Name of file in ./lists folder holding tests to execute in parallel
|
||||
list:
|
||||
type: string
|
||||
# Controls the number of parallel operations and essentially correlates to the --jobs argument of the
|
||||
# parallel command. A value of NONE, indicates the argument is not supplied at all.
|
||||
# For exact usage see:
|
||||
# https://www.gnu.org/software/parallel/parallel_tutorial.html#number-of-simultaneous-jobs
|
||||
max_jobs:
|
||||
type: string
|
||||
default: "NONE"
|
||||
index:
|
||||
type: integer
|
||||
default: 0
|
||||
total:
|
||||
type: integer
|
||||
default: 1
|
||||
steps:
|
||||
- run:
|
||||
name: << parameters.test_name >>
|
||||
command: ./.circleci/run-list-parallel.sh << parameters.list >> << parameters.max_jobs >> << parameters.index >>:<< parameters.total >>
|
||||
- store-artifacts
|
||||
|
||||
jobs:
|
||||
|
||||
deploy-packages:
|
||||
parameters:
|
||||
executor:
|
||||
|
@ -238,8 +328,7 @@ jobs:
|
|||
- run:
|
||||
name: Push to docker hub
|
||||
command: ./.circleci/deploy-all.sh
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
- store-artifacts
|
||||
|
||||
# This deploys a base image of fxa that is useful for CI testing. Think of this image as
|
||||
# the last known good state of fxa. The image is designed to come with everything required
|
||||
|
@ -295,101 +384,71 @@ jobs:
|
|||
docker tag ci-base-browsers-latest << pipeline.parameters.docker-repo >>:ci-base-browsers-latest
|
||||
docker push << pipeline.parameters.docker-repo >>:ci-base-browsers-latest
|
||||
|
||||
test-package:
|
||||
executor: fullstack-executor
|
||||
parameters:
|
||||
package:
|
||||
type: string
|
||||
build-and-validate:
|
||||
executor: default-executor
|
||||
resource_class: large
|
||||
steps:
|
||||
- git-checkout
|
||||
- provision
|
||||
- wait-for-infrastructure
|
||||
- run:
|
||||
name: Testing << parameters.package >>
|
||||
command: ./.circleci/test-package.sh << parameters.package >>
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- run:
|
||||
name: Reporting code coverage...
|
||||
command: bash <(curl -s https://codecov.io/bash) -F << parameters.package >> -X gcov
|
||||
- ts-build
|
||||
- lint
|
||||
- run-tests:
|
||||
test_name: Unit Test (many)
|
||||
list: unit-test.list
|
||||
- jira/notify
|
||||
|
||||
lint:
|
||||
executor: default-executor
|
||||
resource_class: small
|
||||
steps:
|
||||
- git-checkout
|
||||
- run:
|
||||
name: Linting
|
||||
command: |
|
||||
PACKAGES=(\
|
||||
'fxa-shared' \
|
||||
'fxa-auth-server' \
|
||||
)
|
||||
for p in "${PACKAGES[@]}"; do
|
||||
(cd packages/$p && yarn lint)
|
||||
done
|
||||
- jira/notify
|
||||
- provision
|
||||
- ts-build-restore
|
||||
- lint
|
||||
|
||||
test-many:
|
||||
integration-test-part:
|
||||
parameters:
|
||||
index:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
executor: fullstack-executor
|
||||
steps:
|
||||
- git-checkout
|
||||
- provision
|
||||
- ts-build-restore
|
||||
- wait-for-infrastructure
|
||||
- run:
|
||||
name: Testing...
|
||||
command: |
|
||||
PACKAGES=(\
|
||||
'fxa-shared' \
|
||||
'fxa-react' \
|
||||
'fxa-graphql-api' \
|
||||
'fxa-payments-server' \
|
||||
'fxa-admin-server' \
|
||||
'fxa-admin-panel' \
|
||||
'fxa-support-panel' \
|
||||
'fxa-event-broker' \
|
||||
'fxa-profile-server' \
|
||||
'123done' \
|
||||
'browserid-verifier' \
|
||||
'fortress' \
|
||||
'fxa-auth-client' \
|
||||
'fxa-geodb' \
|
||||
'fxa-customs-server' \
|
||||
)
|
||||
for p in "${PACKAGES[@]}"; do
|
||||
./.circleci/test-package.sh $p
|
||||
done
|
||||
- run:
|
||||
name: Reporting code coverage...
|
||||
command: bash <(curl -s https://codecov.io/bash) -F many -X gcov
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
- jira/notify
|
||||
- run-tests:
|
||||
test_name: Integration Test (many)
|
||||
list: integration-test.list
|
||||
max_jobs: "1"
|
||||
index: << parameters.index >>
|
||||
total: << parameters.total >>
|
||||
|
||||
test-settings-server:
|
||||
executor: functional-test-executor
|
||||
steps:
|
||||
- git-checkout
|
||||
- ts-build-restore
|
||||
- provision
|
||||
- wait-for-infrastructure
|
||||
- test-settings-server
|
||||
|
||||
test-content-server-0:
|
||||
test-content-server-part:
|
||||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: large
|
||||
index:
|
||||
type: integer
|
||||
total:
|
||||
type: integer
|
||||
executor: functional-test-executor
|
||||
resource_class: << parameters.resource_class >>
|
||||
steps:
|
||||
- test-content-server-part:
|
||||
index: 0
|
||||
|
||||
test-content-server-1:
|
||||
executor: functional-test-executor
|
||||
steps:
|
||||
- test-content-server-part:
|
||||
index: 1
|
||||
|
||||
test-content-server-2:
|
||||
executor: functional-test-executor
|
||||
steps:
|
||||
- test-content-server-part:
|
||||
index: 2
|
||||
index: << parameters.index >>
|
||||
total: << parameters.total >>
|
||||
|
||||
# This job is manually triggered for now. see .circleci/README.md
|
||||
test-content-server-remote:
|
||||
|
@ -400,11 +459,7 @@ jobs:
|
|||
- run:
|
||||
name: Running test section against a remote target
|
||||
command: ./packages/fxa-content-server/scripts/test-ci-remote.sh
|
||||
- store_artifacts:
|
||||
path: ~/screenshots
|
||||
destination: screenshots
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- store-artifacts
|
||||
|
||||
# These jobs are manually triggered for now. see .circleci/README.md
|
||||
test-content-server-remote-part-0:
|
||||
|
@ -435,17 +490,19 @@ jobs:
|
|||
- run:
|
||||
name: Running smoke tests
|
||||
command: yarn workspace functional-tests test-production
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
- store-artifacts
|
||||
# TODO: Is this actually needed?
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
|
||||
playwright-functional-tests:
|
||||
executor: functional-test-executor
|
||||
parallelism: 5
|
||||
resource_class: large
|
||||
parallelism: 3
|
||||
steps:
|
||||
- git-checkout
|
||||
- provision
|
||||
- ts-build-restore
|
||||
- run:
|
||||
name: Ensure playwright install
|
||||
# The base install script always skips playwright browser installs in an attempt
|
||||
|
@ -464,13 +521,7 @@ jobs:
|
|||
- run:
|
||||
name: Running playwright tests
|
||||
command: ./packages/functional-tests/scripts/test-ci.sh
|
||||
- store_artifacts:
|
||||
path: ~/.pm2/logs
|
||||
destination: logs
|
||||
- store_artifacts:
|
||||
path: artifacts
|
||||
- store_test_results:
|
||||
path: artifacts/tests
|
||||
- store-artifacts
|
||||
|
||||
build-and-deploy-storybooks:
|
||||
executor: default-executor
|
||||
|
@ -486,72 +537,79 @@ jobs:
|
|||
steps:
|
||||
- cache-save-yarn
|
||||
|
||||
|
||||
workflows:
|
||||
|
||||
# This workflow is executed whenever a pull request is issued. It will also
|
||||
# run on PR drafts.
|
||||
test_pull_request:
|
||||
jobs:
|
||||
- lint:
|
||||
- build-and-validate:
|
||||
name: Build > Lint > Unit Test
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
ignore: /main/
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- test-many:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- integration-test-part:
|
||||
name: Integration Test Part 1
|
||||
index: 0
|
||||
total: 2
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
- test-settings-server:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- test-package:
|
||||
name: test-auth-server
|
||||
package: fxa-auth-server
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- test-content-server-0:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- test-content-server-1:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- test-content-server-2:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- playwright-functional-tests:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
- integration-test-part:
|
||||
name: Integration Test Part 2
|
||||
index: 1
|
||||
total: 2
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
- build-and-deploy-storybooks:
|
||||
filters:
|
||||
branches:
|
||||
ignore: main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
name: Story Book Build & Deploy
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
- test-settings-server:
|
||||
name: Functional Tests - Settings Server
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 1
|
||||
index: 0
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 2
|
||||
index: 1
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 3
|
||||
index: 2
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 4
|
||||
index: 3
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 5
|
||||
index: 4
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
- playwright-functional-tests:
|
||||
name: Playwright Functional Tests
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
|
||||
# This workflow can be useful if we want to run test changes in our functional tests
|
||||
# against deployed code. Simply prefix a branch with run-smoke-tests, and issue a PR.
|
||||
|
@ -567,7 +625,6 @@ workflows:
|
|||
- production-smoke-tests:
|
||||
requires:
|
||||
- request-production-smoke-tests
|
||||
|
||||
- request-test-content-server-remote:
|
||||
type: approval
|
||||
filters:
|
||||
|
@ -578,7 +635,6 @@ workflows:
|
|||
- test-content-server-remote:
|
||||
requires:
|
||||
- request-test-content-server-remote
|
||||
|
||||
- request-test-content-server-remote-parts:
|
||||
type: approval
|
||||
filters:
|
||||
|
@ -596,6 +652,7 @@ workflows:
|
|||
requires:
|
||||
- request-test-content-server-remote-parts
|
||||
|
||||
# This workflow is primarily triggered after PRs are approved and land on main.
|
||||
deploy_branch:
|
||||
jobs:
|
||||
- deploy-packages:
|
||||
|
@ -608,7 +665,6 @@ workflows:
|
|||
- /^dockerpush.*/
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- deploy-fxa-ci-image:
|
||||
executor: docker-build-executor
|
||||
filters:
|
||||
|
@ -617,14 +673,12 @@ workflows:
|
|||
- main
|
||||
tags:
|
||||
ignore: /.*/
|
||||
|
||||
- deploy-fxa-ci-browser-image:
|
||||
requires:
|
||||
- deploy-fxa-ci-image
|
||||
executor:
|
||||
name: docker-build-executor
|
||||
image: cimg/node:16.13-browsers
|
||||
|
||||
- build-and-deploy-storybooks:
|
||||
requires:
|
||||
- deploy-fxa-ci-image
|
||||
|
@ -635,46 +689,59 @@ workflows:
|
|||
requires:
|
||||
- deploy-fxa-ci-image
|
||||
|
||||
# This workflow is used for building docker containers that are then deployed to
|
||||
# live infrastructure.
|
||||
test_and_deploy_tag:
|
||||
jobs:
|
||||
- lint:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-many:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-package:
|
||||
name: test-auth-server
|
||||
package: fxa-auth-server
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-content-server-0:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-content-server-1:
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- test-content-server-2:
|
||||
- build-and-validate:
|
||||
name: Build > Lint > Unit Test
|
||||
filters:
|
||||
branches:
|
||||
ignore: /.*/
|
||||
tags:
|
||||
only: /.*/
|
||||
- integration-test-part:
|
||||
name: Integration Test Part 1
|
||||
index: 0
|
||||
total: 1
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- integration-test-part:
|
||||
name: Integration Test Part 2
|
||||
index: 1
|
||||
total: 1
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 1
|
||||
index: 0
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 2
|
||||
index: 1
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 3
|
||||
index: 2
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 4
|
||||
index: 3
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- test-content-server-part:
|
||||
name: Content Server Functional Test Part 5
|
||||
index: 4
|
||||
total: 5
|
||||
requires:
|
||||
- Build > Lint > Unit Test
|
||||
- deploy-packages:
|
||||
executor: docker-build-executor
|
||||
filters:
|
||||
|
@ -683,8 +750,11 @@ workflows:
|
|||
tags:
|
||||
only: /.*/
|
||||
requires:
|
||||
- test-many
|
||||
- test-auth-server
|
||||
- test-content-server-0
|
||||
- test-content-server-1
|
||||
- test-content-server-2
|
||||
- Build > Lint > Unit Test
|
||||
- Integration Test Part 1
|
||||
- Integration Test Part 2
|
||||
- Content Server Functional Test Part 1
|
||||
- Content Server Functional Test Part 2
|
||||
- Content Server Functional Test Part 3
|
||||
- Content Server Functional Test Part 4
|
||||
- Content Server Functional Test Part 5
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
# Determine which workspaces have been modified
|
||||
node .circleci/modules-to-test.js | tee packages/test.list
|
||||
|
||||
# Create empty files
|
||||
mkdir -p .lists
|
||||
echo '' > .lists/ts-build-includes.list
|
||||
echo '' > .lists/lint.list
|
||||
echo '' > .lists/lint-includes.list
|
||||
echo '' > .lists/unit-test.list
|
||||
echo '' > .lists/unit-test-includes.list
|
||||
echo '' > .lists/integration-test.list
|
||||
echo '' > .lists/integration-test-includes.list
|
||||
|
||||
function genWorkspaceCmd() {
|
||||
if [ -f "packages/$1/package.json" ]; then
|
||||
if [[ $(cat packages/$1/package.json | jq ".scripts.\"$2\"") != null ]]; then
|
||||
echo ".circleci/notify.sh 'Starting $1 -> $2' && NODE_ENV=test yarn workspace $1 run $2" >> .lists/$3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
function genIncludeArgs() {
|
||||
if [ -f "packages/$1/package.json" ]; then
|
||||
echo "Processing packages/$1/package.json "
|
||||
if [[ $(cat packages/$1/package.json | jq ".scripts.\"$2\"") != null ]]; then
|
||||
echo "--include $1" >> .lists/$3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
if [[ $(cat packages/test.list) == *all* ]]; then
|
||||
echo "Testing All Packages";
|
||||
ls -1 packages > .lists/test.list
|
||||
else
|
||||
cp packages/test.list .lists/test.list
|
||||
fi
|
||||
|
||||
# Loop over test.list and look for common scripts that might be applicable to run.
|
||||
while read pkg
|
||||
do
|
||||
|
||||
# Creates a list of --include filters for yarn various workspace commands.
|
||||
genIncludeArgs $pkg compile ts-build-includes.list
|
||||
genIncludeArgs $pkg lint lint-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
|
||||
|
||||
done < .lists/test.list
|
|
@ -0,0 +1,27 @@
|
|||
#/bin/bash -ex
|
||||
|
||||
LIST=".lists/lint-includes.list"
|
||||
|
||||
if [[ ! -f $LIST ]]; then
|
||||
echo "List isn't a valid file: $LIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# Note: Not everything lints cleanly at the moment. Once this is fixed, remove --exclude args.
|
||||
|
||||
yarn workspaces foreach \
|
||||
-piv \
|
||||
$(cat $LIST) \
|
||||
--exclude=browserid-verifier \
|
||||
--exclude=functional-tests\
|
||||
--exclude=fxa-admin-panel \
|
||||
--exclude=fxa-admin-server \
|
||||
--exclude=fxa-auth-client \
|
||||
--exclude=fxa-customs-server \
|
||||
--exclude=fxa-event-broker \
|
||||
--exclude=fxa-graphql-api \
|
||||
--exclude=fxa-payments-server \
|
||||
--exclude=fxa-settings \
|
||||
--exclude=fxa-support-panel \
|
||||
run lint;
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
echo "
|
||||
|
||||
|
||||
|
||||
|
||||
=======================================================================
|
||||
$1
|
||||
=======================================================================
|
||||
"
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
LIST=$1
|
||||
|
||||
if [[ $LIST == "" ]]; then
|
||||
echo "Missing list argument! Supply an argument. e.g. report-coverage.sh packages/unit-test-includes.list"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $LIST ]; then
|
||||
echo "List isn't a valid file: $LIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yarn workspaces foreach \
|
||||
-piv
|
||||
$(cat $LIST) \
|
||||
exec '../../_scripts/report-coverage.sh $npm_package_name'
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
LIST=$1
|
||||
|
||||
if [[ $LIST == "" ]]; then
|
||||
echo "Missing list argument! Supply an argument. e.g. report-coverage.sh packages/unit-test-includes.list"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f $LIST ]; then
|
||||
echo "List isn't a valid file: $LIST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
yarn workspaces foreach \
|
||||
-piv
|
||||
$(cat $LIST) \
|
||||
exec '../../_scripts/report-coverage.sh $npm_package_name'
|
|
@ -0,0 +1,76 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
LIST=$1
|
||||
MAX_JOBS=$2
|
||||
|
||||
if [[ $1 == "" || $2 == "" ]]; then
|
||||
echo "Missing arguments! Invocation should be, run-list-parallel.sh \$LIST \$MAX_JOBS \$GROUP. i.e. run-list-parallel.sh unit-test.list -1 3/4"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f .lists/$LIST ]]; then
|
||||
echo "List isn't a valid file: $LIST"
|
||||
exit 1
|
||||
fi
|
||||
JOBLOG="--joblog artifacts/tests/$LIST.log"
|
||||
|
||||
if [[ $MAX_JOBS == "NONE" ]]; then
|
||||
MAX_JOBS=""
|
||||
else
|
||||
MAX_JOBS="-j $2"
|
||||
fi
|
||||
|
||||
GROUP=$3
|
||||
if [[ $GROUP == "" ]]; then
|
||||
INDEX=0
|
||||
TOTAL=1
|
||||
else
|
||||
arr=(${GROUP//:/ })
|
||||
INDEX=$((${arr[0]}))
|
||||
TOTAL=$((${arr[1]}))
|
||||
fi
|
||||
|
||||
|
||||
# Quick integrity check on total / index
|
||||
if $TOTAL > 24; then
|
||||
echo "Invalid GROUP argument - $GROUP. Total groups must be be less than 24."
|
||||
exit 1
|
||||
fi
|
||||
if $INDEX < 0 || $INDEX >= $TOTAL; then
|
||||
echo "Invalid GROUP argument - $GROUP. INDEX must be positive and less than total."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Determine the total number of operaitons in the list file
|
||||
TOTAL_OPERATIONS=$(cat .lists/$LIST | wc -l | sed -e 's/ //g' )
|
||||
|
||||
# Divide the total operations by the total parts requrested to get group size
|
||||
GROUP_SIZE=$(echo "$TOTAL_OPERATIONS $TOTAL" | awk '{print $1/$2}')
|
||||
FLOOR_GROUP_SIZE=$(echo "$TOTAL_OPERATIONS $TOTAL" | awk '{print int($1/$2)}')
|
||||
if [[ $GROUP_SIZE != $FLOOR_GROUP_SIZE ]]; then
|
||||
echo "$TOTAL groups were requested and there are $TOTAL_OPERATIONS operations. Rounding group size up to ensure no operations are lost!"
|
||||
GROUP_SIZE=$(($FLOOR_GROUP_SIZE+1))
|
||||
fi
|
||||
|
||||
# Split file into N parts, which will produce files like $name-aa, $name-ab, etc...
|
||||
# Next determine split files postfix. 97 is the ascii character code for 'a', by adding
|
||||
# our current index to this value we will get the correct postfix of the file we want
|
||||
# to target.
|
||||
#
|
||||
# Note that we limit the value of TOTAL to 24, which ensures no more than xaa - xaz
|
||||
# file parts are created.
|
||||
#
|
||||
split -l $GROUP_SIZE .lists/$LIST .lists/$LIST-
|
||||
SPLIT_FILE=a$(printf "\x$(printf %x $((97+$INDEX)))")
|
||||
echo "Running operations in parallel"
|
||||
echo " - Group: $((INDEX+1)) of $TOTAL."
|
||||
echo " - Operation Count: $GROUP_SIZE"
|
||||
echo " - Operation list: .lists/$LIST-$SPLIT_FILE"
|
||||
|
||||
# Make sure the test folder exists in the artifacts dir
|
||||
mkdir -p artifacts/tests
|
||||
|
||||
# Executes the command in the LIST file in parallel. Some notes on options
|
||||
# Setting --load let's us wait for a heavy test suite to finish before starting another one
|
||||
# Setting --joblog preserves the output in a log file.
|
||||
parallel $MAX_JOBS --load 50% --halt 0 --joblog artifacts/tests/$LIST-$SPLIT_FILE.log < .lists/$LIST-$SPLIT_FILE
|
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
MODULE=$1
|
||||
TEST=$2
|
||||
DIR=$(dirname "$0")
|
||||
|
||||
if grep -e "$MODULE" -e 'all' "$DIR/../packages/test.list" > /dev/null; then
|
||||
|
@ -16,7 +17,7 @@ if grep -e "$MODULE" -e 'all' "$DIR/../packages/test.list" > /dev/null; then
|
|||
time ./scripts/test-ci.sh
|
||||
else
|
||||
# default action
|
||||
time (yarn workspaces focus "$MODULE" && NODE_ENV=test yarn test)
|
||||
time (NODE_ENV=test yarn workspace $MODULE $TEST)
|
||||
fi
|
||||
else
|
||||
echo -e "\n###################################"
|
||||
|
|
|
@ -8,5 +8,9 @@
|
|||
"require-atomic-updates": "off",
|
||||
"space-unary-ops": "off",
|
||||
"no-useless-escape": "off"
|
||||
}
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -148,3 +148,4 @@ packages/fxa-settings/test/
|
|||
Library
|
||||
.node
|
||||
process.yml
|
||||
.lists
|
||||
|
|
|
@ -58,7 +58,6 @@ module.exports = {
|
|||
{
|
||||
name: 'otel-collector',
|
||||
script: '_scripts/otel-collector.sh',
|
||||
max_restarts: '1',
|
||||
autorestart: false,
|
||||
kill_timeout: 20000,
|
||||
},
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
bash <(curl -s https://codecov.io/bash) -F $1 -X gcov
|
|
@ -0,0 +1,19 @@
|
|||
#/bin/bash -ex
|
||||
|
||||
CMD=$1
|
||||
INCLUDE=''
|
||||
|
||||
while IFS= read -r line; do
|
||||
echo "Including: $line"
|
||||
INCLUDE="--include $line $INCLUDE";
|
||||
if [[ $line =~ all ]] ; then
|
||||
echo 'Running All Tests'
|
||||
INCLUDE='';
|
||||
break;
|
||||
fi
|
||||
done < packages/test.list
|
||||
|
||||
NODE_ENV=test yarn workspaces foreach $INCLUDE \
|
||||
--verbose \
|
||||
--interlaced \
|
||||
--parallel run $CMD;
|
|
@ -79,6 +79,8 @@
|
|||
"eslint-plugin-jest": "^27.1.3",
|
||||
"eslint-plugin-react": "^7.31.10",
|
||||
"json": "^11.0.0",
|
||||
"mocha-junit-reporter": "^2.2.0",
|
||||
"mocha-multi": "^1.1.7",
|
||||
"postcss": "^8.4.14",
|
||||
"stylelint": "^14.14.0",
|
||||
"stylelint-config-prettier": "^9.0.3",
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
"extends": ["plugin:fxa/server"],
|
||||
"plugins": ["fxa"],
|
||||
"ignorePatterns": [
|
||||
"static"
|
||||
"static",
|
||||
"node_modules"
|
||||
],
|
||||
"root": true
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@
|
|||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "npm run lint",
|
||||
"test:unit": "echo 'No unit tests present!'",
|
||||
"test:integration": "echo 'No integration tests present!' ",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
"private": true,
|
||||
"scripts": {
|
||||
"record": "playwright test --project=stub --debug",
|
||||
"test:unit": "echo 'No unit tests present!'",
|
||||
"test:integration": "echo 'No integration tests present!'",
|
||||
"test": "playwright test --project=local",
|
||||
"test-local": "playwright test --project=local",
|
||||
"test-stage": "playwright test --project=stage",
|
||||
|
|
|
@ -6,12 +6,7 @@ cd "$DIR/../../../"
|
|||
|
||||
mkdir -p ~/.pm2/logs
|
||||
mkdir -p artifacts/tests
|
||||
|
||||
#npx playwright install --with-deps
|
||||
|
||||
node ./packages/db-migrations/bin/patcher.mjs
|
||||
|
||||
yarn workspaces foreach \
|
||||
CI=true yarn workspaces foreach \
|
||||
--verbose \
|
||||
--topological-dev \
|
||||
--include 123done \
|
||||
|
@ -27,8 +22,5 @@ yarn workspaces foreach \
|
|||
run start > ~/.pm2/logs/startup.log
|
||||
|
||||
npx pm2 ls
|
||||
|
||||
#yarn workspace functional-tests test
|
||||
|
||||
circleci tests glob "packages/functional-tests/tests/**/*.spec.ts" | circleci tests split > tests-to-run.txt
|
||||
yarn workspace functional-tests test $(cat tests-to-run.txt|awk -F"/" '{ print $NF }')
|
||||
|
|
|
@ -14,11 +14,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": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test --coverage --verbose",
|
||||
"test:server": "jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit",
|
||||
"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",
|
||||
"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",
|
||||
"test": "CI=true npm-run-all test:frontend test:server",
|
||||
"test:unit": "test",
|
||||
"test:integration": "echo 'No integration tests present!'"
|
||||
"test:unit": "yarn build-css && yarn build:client && yarn test",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
transform: {
|
||||
'^.+\\.tsx?$': 'ts-jest',
|
||||
'^.+\\.tsx?$': ['ts-jest', { isolatedModules: true }],
|
||||
},
|
||||
coveragePathIgnorePatterns: ['<rootDir>'],
|
||||
collectCoverageFrom: ['**/*.js', '!**/jest*js'],
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"prebuild": "rimraf dist",
|
||||
"build": "yarn prebuild && yarn nest build && cp ./src/config/*.json ./dist/config",
|
||||
"compile": "tsc --noEmit",
|
||||
"lint": "eslint *",
|
||||
"lint": "eslint .",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"start": "yarn build && pm2 start pm2.config.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
|
@ -15,8 +15,8 @@
|
|||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "yarn gen-keys && yarn test:default && yarn test:e2e ",
|
||||
"gen-keys": "node -r esbuild-register ./scripts/gen_keys.ts;",
|
||||
"test:unit": "jest --runInBand --forceExit -t '#unit' ",
|
||||
"test:integration": "jest --runInBand --forceExit -t '#integration' ",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --runInBand --coverage --forceExit --logHeapUsage -t '#unit' --ci --reporters=default --reporters=jest-junit",
|
||||
"test:integration": "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",
|
||||
"test:watch": "jest --watch",
|
||||
"test:cov": "jest --coverage",
|
||||
|
@ -93,7 +93,12 @@
|
|||
"rootDir": "src",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"isolatedModules": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
|
|
|
@ -7,12 +7,18 @@ const PATH = process.env.PATH.split(':')
|
|||
.join(':');
|
||||
|
||||
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
||||
const getDevScript = () => `${nest} start --debug=9150 --watch`;
|
||||
const getProdScript = () => 'rm -rf dist && yarn build && node dist/main.js';
|
||||
const script =
|
||||
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
||||
? getProdScript()
|
||||
: getDevScript();
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'admin-server',
|
||||
script: `${nest} start --debug=9150 --watch`,
|
||||
script,
|
||||
cwd: __dirname,
|
||||
max_restarts: '1',
|
||||
min_uptime: '2m',
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [ "ts-jest", { "isolatedModules": true } ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
"build": "tsc --build tsconfig.browser.json && tsc --build",
|
||||
"compile": "yarn build",
|
||||
"test": "mocha -r esbuild-register test/*",
|
||||
"test:unit": "yarn test",
|
||||
"test:integration": "echo 'No integration tests present!'"
|
||||
"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",
|
||||
|
@ -37,5 +37,9 @@
|
|||
"mocha": "^10.0.0",
|
||||
"typescript": "^4.9.3",
|
||||
"webcrypto-liner": "https://github.com/mozilla-fxa/webcrypto-liner.git#30d4ecdfbbe33535ad43f31bf3f0407edce543a3"
|
||||
},
|
||||
"mocha": {
|
||||
"reporter": "mocha-multi",
|
||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,11 +21,9 @@
|
|||
"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:unit": "yarn merge-ftl:test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=unit scripts/test-local.sh",
|
||||
"test:integration": "yarn merge-ftl:test && yarn emails-scss && VERIFIER_VERSION=0 TEST_TYPE=integration scripts/test-local.sh",
|
||||
"test-ci": "yarn merge-ftl:test && scripts/test-local.sh && npm run test-e2e",
|
||||
"test-ci:unit": "yarn merge-ftl:test && TEST_TYPE=unit scripts/test-local.sh",
|
||||
"test-ci:integration": "yarn merge-ftl:test && TEST_TYPE=integration 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",
|
||||
|
@ -198,7 +196,6 @@
|
|||
"mailparser": "0.6.1",
|
||||
"mjml-browser": "^4.13.0",
|
||||
"mocha": "^10.0.0",
|
||||
"mocha-junit-reporter": "^2.1.0",
|
||||
"moment": "^2.29.4",
|
||||
"nock": "^13.2.2",
|
||||
"nodemon": "^2.0.19",
|
||||
|
@ -219,5 +216,9 @@
|
|||
"webpack": "^4.43.0",
|
||||
"webpack-watch-files-plugin": "^1.2.1",
|
||||
"ws": "^8.11.0"
|
||||
},
|
||||
"mocha": {
|
||||
"reporter": "mocha-multi",
|
||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,8 @@ const vapidKeysFile = config.get('vapidKeysFile');
|
|||
const fileExists = fs.existsSync(vapidKeysFile);
|
||||
if (fileExists) {
|
||||
console.log('keys file already exists');
|
||||
process.exit();
|
||||
return;
|
||||
// process.exit();
|
||||
}
|
||||
|
||||
console.error('Generating key for VAPID');
|
||||
|
|
|
@ -3,35 +3,42 @@
|
|||
DIR=$(dirname "$0")
|
||||
cd "$DIR/.."
|
||||
|
||||
yarn workspaces focus fxa-auth-server
|
||||
# TODO: Shouldn't be needed... Validate that's true.
|
||||
# yarn workspaces focus fxa-auth-server
|
||||
|
||||
export NODE_ENV=dev
|
||||
export CORS_ORIGIN="http://foo,http://bar"
|
||||
|
||||
DEFAULT_ARGS="--require esbuild-register --recursive --timeout 5000 --exit --reporter mocha-junit-reporter"
|
||||
DEFAULT_ARGS="--require esbuild-register --recursive --timeout 5000 --exit "
|
||||
if [ "$TEST_TYPE" == 'unit' ]; then GREP_TESTS="--grep #integration --invert "; fi;
|
||||
if [ "$TEST_TYPE" == 'integration' ]; then GREP_TESTS="--grep #integration "; fi;
|
||||
|
||||
node -r esbuild-register ./scripts/gen_keys.js
|
||||
node -r esbuild-register ./scripts/gen_vapid_keys.js
|
||||
node -r esbuild-register ./scripts/oauth_gen_keys.js
|
||||
../../_scripts/check-mysql.sh
|
||||
../../_scripts/check-url.sh localhost:9090
|
||||
node ../db-migrations/bin/patcher.mjs
|
||||
|
||||
# Make sure we have a fresh version of l10n files... This is just a sanity check. It shouldn't be needed...
|
||||
# rm -rf public
|
||||
# yarn run postinstall
|
||||
|
||||
echo 'Updating ftl files'
|
||||
# Migrate current strings
|
||||
yarn run merge-ftl
|
||||
yarn run merge-ftl:test
|
||||
|
||||
# Process sass for rendering of email templates
|
||||
echo
|
||||
yarn run emails-scss
|
||||
|
||||
TESTS=(local oauth remote scripts)
|
||||
if [ "$TEST_TYPE" == 'integration' ]; then
|
||||
TESTS=(oauth remote);
|
||||
else
|
||||
TESTS=(local scripts)
|
||||
fi;
|
||||
|
||||
for t in "${TESTS[@]}"; do
|
||||
echo "testing $t"
|
||||
./scripts/mocha-coverage.js $DEFAULT_ARGS --reporter-options mochaFile="../../artifacts/tests/$t/test-results.xml" "test/$t"
|
||||
echo -e "\n\nTesting: $t"
|
||||
|
||||
#./scripts/mocha-coverage.js $DEFAULT_ARGS $GREP_TESTS --reporter-options mochaFile="../../artifacts/tests/fxa-auth-server/$t/test-results.xml" "test/$t"
|
||||
MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-$TEST_TYPE-$t.xml mocha $DEFAULT_ARGS $GREP_TESTS test/$t
|
||||
done
|
||||
|
||||
yarn run clean-up-old-ci-stripe-customers
|
||||
if [ "$TEST_TYPE" == 'integration' ]; then
|
||||
yarn run clean-up-old-ci-stripe-customers;
|
||||
fi;
|
||||
|
|
|
@ -35,7 +35,7 @@ const sampleIpnMessage =
|
|||
|
||||
const sandbox = sinon.createSandbox();
|
||||
|
||||
describe('PayPalClient', () => {
|
||||
describe('#integration - PayPalClient', () => {
|
||||
/** @type {PayPalClient} */
|
||||
let client;
|
||||
|
||||
|
|
|
@ -1449,7 +1449,7 @@ describe('/account/status', () => {
|
|||
});
|
||||
});
|
||||
|
||||
it('returns invalid for an invalid email domain', async () => {
|
||||
it('#integration -returns invalid for an invalid email domain', async () => {
|
||||
const { route, mockRequest } = setup();
|
||||
mockRequest.payload.email = 'test@bad.domain';
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ describe('support', () => {
|
|||
nock.isDone();
|
||||
});
|
||||
|
||||
it('should handle retrying an update user call', async () => {
|
||||
it('#integration - should handle retrying an update user call', async () => {
|
||||
config.subscriptions.enabled = true;
|
||||
nock(`https://${SUBDOMAIN}.zendesk.com`)
|
||||
.post('/api/v2/requests.json')
|
||||
|
|
|
@ -302,13 +302,13 @@ describe('Sentry', () => {
|
|||
|
||||
it('reports valid error with error', async () => {
|
||||
await emitError(_testError(errorCode, errno, new Error('BOOM')));
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||
sandbox.assert.calledOnce(sentryCaptureSpy);
|
||||
});
|
||||
|
||||
it('reports valid error with inner error', async () => {
|
||||
await emitError(_testError(errorCode, errno, new Error('BOOM')));
|
||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||
await new Promise((resolve) => setTimeout(resolve, 1));
|
||||
sandbox.assert.calledOnce(sentryCaptureSpy);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -10,7 +10,7 @@ const { execFileSync } = require('child_process');
|
|||
const crypto = require('crypto');
|
||||
const rimraf = require('rimraf');
|
||||
|
||||
describe('the signing-key management scripts', function () {
|
||||
describe('#integration - the signing-key management scripts', function () {
|
||||
let runScript;
|
||||
let workDir, keyFile, newKeyFile, oldKeyFile;
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ const execOptions = {
|
|||
},
|
||||
};
|
||||
|
||||
describe('scripts/delete-account:', () => {
|
||||
describe('#integration - scripts/delete-account:', () => {
|
||||
it('does not fail', () => {
|
||||
return execAsync(
|
||||
'node -r esbuild-register scripts/delete-account',
|
||||
|
|
|
@ -23,8 +23,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!'",
|
||||
"test:integration": "yarn test",
|
||||
"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": {
|
||||
|
|
|
@ -19,15 +19,11 @@ mkdir -p config
|
|||
cp ../version.json ./
|
||||
cp ../version.json config
|
||||
|
||||
# TODO: Move this to build-lint phase
|
||||
yarn lint
|
||||
|
||||
cd ../../
|
||||
mkdir -p ~/.pm2/logs
|
||||
mkdir -p artifacts/tests
|
||||
node ./packages/db-migrations/bin/patcher.mjs
|
||||
|
||||
yarn workspaces foreach \
|
||||
CI=true yarn workspaces foreach \
|
||||
--verbose \
|
||||
--topological-dev \
|
||||
--include 123done \
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
check-coverage: false
|
|
@ -20,9 +20,10 @@
|
|||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint": "eslint .",
|
||||
"test": "scripts/test-local.sh",
|
||||
"test:unit": "tap test/local --no-coverage --jobs=1",
|
||||
"test:integration": "tap test/remote test/scripts --no-coverage --jobs=1",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@google-cloud/pubsub": "^2.19.4",
|
||||
|
@ -63,6 +64,7 @@
|
|||
"restify-clients": "^4.2.0",
|
||||
"sinon": "^9.0.3",
|
||||
"tap": "^16.3.0",
|
||||
"tap-xunit": "^2.4.1",
|
||||
"walk": "^2.3.15"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
"start:prod": "node dist/main",
|
||||
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||
"test": "jest",
|
||||
"test:unit": "jest -t '#unit'",
|
||||
"test:integration": "jest -t '#integration' ",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --forceExit --detectOpenHandles --logHeapUsage -t '#unit' --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",
|
||||
|
@ -118,7 +118,12 @@
|
|||
"rootDir": "src",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"isolatedModules": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#!/bin/bash -e
|
||||
|
||||
yarn workspaces focus fxa-event-broker
|
||||
yarn test --runInBand
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [ "ts-jest", { "isolatedModules": true } ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,5 +4,9 @@
|
|||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"ignorePatterns": [
|
||||
"dist",
|
||||
"node_modules"
|
||||
],
|
||||
"root": true
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"lint": "eslint .",
|
||||
"test": "mocha",
|
||||
"test:unit": "mocha --grep '#unit' ",
|
||||
"test:integration": "mocha --grep '#integration' ",
|
||||
"test:unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha --grep '#unit'",
|
||||
"test:integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-integration.xml mocha --grep '#integration'",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -47,5 +47,9 @@
|
|||
"prettier": "^2.3.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"sinon": "^14.0.0"
|
||||
},
|
||||
"mocha": {
|
||||
"reporter": "mocha-multi",
|
||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,9 +95,9 @@ describe('maxmind-db-downloader', function () {
|
|||
describe('#integration - setupAutoUpdate', function () {
|
||||
it('auto update calls downloadAll correctly', function (done) {
|
||||
// test takes slightly over 5 seconds, set
|
||||
// timeout to 6 seconds to ensure that we don't
|
||||
// timeout to 10 seconds to ensure that we don't
|
||||
// timeout prematurely.
|
||||
this.timeout(6000);
|
||||
this.timeout(10000);
|
||||
sinon.stub(maxmindDbDownloader, 'downloadAll').callsFake(function () {});
|
||||
targetDirPath = maxmindDbDownloader.createTargetDir('test-db');
|
||||
downloadPromiseFunctions = maxmindDbDownloader.setupDownloadList(
|
||||
|
|
|
@ -6,20 +6,20 @@
|
|||
"prebuild": "rimraf dist",
|
||||
"build": "nest build",
|
||||
"compile": "tsc --noEmit",
|
||||
"lint": "eslint *",
|
||||
"lint": "eslint .",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"watch": "tsc -w",
|
||||
"start": "pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:8290/__heartbeat__",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test:unit": "jest --runInBand -t '#unit'",
|
||||
"test:integration": "jest --runInBand -t '#integration' && yarn test:e2e",
|
||||
"test": "jest --runInBand && yarn test:e2e",
|
||||
"test:unit": "JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --forceExit -t '#unit' --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",
|
||||
"test:e2e": "jest --runInBand --config ./test/jest-e2e.json",
|
||||
"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": {
|
||||
|
@ -86,6 +86,7 @@
|
|||
"@types/graphql": "^14.5.0",
|
||||
"@types/graphql-upload": "^8.0.5",
|
||||
"@types/ioredis": "^4.26.4",
|
||||
"@types/jest": "^29.2.5",
|
||||
"@types/node": "^16.11.3",
|
||||
"@types/passport": "^1.0.6",
|
||||
"@types/passport-http-bearer": "^1.0.36",
|
||||
|
@ -97,7 +98,7 @@
|
|||
"esbuild": "^0.14.2",
|
||||
"esbuild-register": "^3.2.0",
|
||||
"eslint": "^7.32.0",
|
||||
"jest": "27.5.1",
|
||||
"jest": "29.3.1",
|
||||
"nock": "^13.2.2",
|
||||
"pm2": "^5.2.2",
|
||||
"prettier": "^2.3.1",
|
||||
|
@ -114,7 +115,12 @@
|
|||
"rootDir": "src",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"isolatedModules": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"coverageDirectory": "./coverage",
|
||||
"testEnvironment": "node"
|
||||
|
|
|
@ -7,12 +7,18 @@ const PATH = process.env.PATH.split(':')
|
|||
.join(':');
|
||||
|
||||
const nest = require.resolve('@nestjs/cli/bin/nest.js');
|
||||
const getNestScript = () => `${nest} start`;
|
||||
const getProdScript = () => 'rm -rf dist && yarn build && node dist/main.js';
|
||||
const script =
|
||||
process.env.CI === 'true' || process.env.NODE_ENV === 'production'
|
||||
? getProdScript()
|
||||
: getNestScript();
|
||||
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'gql-api',
|
||||
script: `${nest} start --debug=9200 --watch`,
|
||||
script,
|
||||
cwd: __dirname,
|
||||
max_restarts: '1',
|
||||
min_uptime: '2m',
|
||||
|
@ -20,6 +26,7 @@ module.exports = {
|
|||
PATH,
|
||||
NODE_ENV: 'development',
|
||||
TS_NODE_TRANSPILE_ONLY: 'true',
|
||||
TS_NODE_COMPILER: 'typescript-cached-transpile',
|
||||
TS_NODE_FILES: 'true',
|
||||
PORT: '8290', // TODO: this needs to get added to src/config.ts
|
||||
CUSTOMS_SERVER_URL: 'none',
|
||||
|
|
|
@ -15,6 +15,6 @@ export class FinishSetupInput {
|
|||
@Field()
|
||||
public token!: string;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public authPW!: hexstring;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ export class SessionReauthOptionsInput extends SignInOptionsInput {}
|
|||
|
||||
@InputType()
|
||||
export class SessionReauthInput extends SignInInput {
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public sessionToken!: hexstring;
|
||||
|
||||
@Field()
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import { Field, InputType } from '@nestjs/graphql';
|
||||
import { Field, InputType, ObjectType } from '@nestjs/graphql';
|
||||
import { MetricsContext } from './metrics-context';
|
||||
|
||||
@InputType()
|
||||
|
@ -40,7 +40,7 @@ export class SignInInput {
|
|||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public authPW!: hexstring;
|
||||
|
||||
@Field()
|
||||
|
|
|
@ -23,7 +23,7 @@ export class SignUpOptionsInput {
|
|||
@Field({ nullable: true })
|
||||
public verificationMethod?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Field((type) => String, { nullable: true })
|
||||
public preVerified?: BoolString;
|
||||
|
||||
@Field((type) => MetricsContext, { nullable: true })
|
||||
|
@ -38,7 +38,7 @@ export class SignUpInput {
|
|||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public authPW!: hexstring;
|
||||
|
||||
@Field()
|
||||
|
|
|
@ -11,10 +11,10 @@ export class FinishedSetupAccountPayload {
|
|||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public uid!: hexstring;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public sessionToken!: hexstring;
|
||||
|
||||
@Field()
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class SessionReauthedAccountPayload {
|
||||
@Field({
|
||||
description: 'A unique identifier for the client performing the mutation.',
|
||||
nullable: true,
|
||||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field((type) => String)
|
||||
public uid!: hexstring;
|
||||
|
||||
@Field()
|
||||
verified!: boolean;
|
||||
|
||||
@Field()
|
||||
authAt!: number;
|
||||
|
||||
@Field()
|
||||
metricsEnabled!: boolean;
|
||||
|
||||
@Field((type) => String, { nullable: true })
|
||||
keyFetchToken?: hexstring;
|
||||
|
||||
@Field({ nullable: true })
|
||||
verificationMethod?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
verificationReason?: string;
|
||||
}
|
|
@ -1,43 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
import { Field, ObjectType, OmitType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
import { SessionReauthedAccountPayload } from './session-reauthed-account';
|
||||
|
||||
@ObjectType()
|
||||
export class SignedInAccountPayload {
|
||||
@Field({
|
||||
description: 'A unique identifier for the client performing the mutation.',
|
||||
nullable: true,
|
||||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field()
|
||||
public uid!: hexstring;
|
||||
|
||||
@Field()
|
||||
export class SignedInAccountPayload extends SessionReauthedAccountPayload {
|
||||
@Field((type) => String)
|
||||
public sessionToken!: hexstring;
|
||||
|
||||
@Field()
|
||||
verified!: boolean;
|
||||
|
||||
@Field()
|
||||
authAt!: number;
|
||||
|
||||
@Field()
|
||||
metricsEnabled!: boolean;
|
||||
|
||||
@Field({ nullable: true })
|
||||
keyFetchToken?: hexstring;
|
||||
|
||||
@Field({ nullable: true })
|
||||
verificationMethod?: string;
|
||||
|
||||
@Field({ nullable: true })
|
||||
verificationReason?: string;
|
||||
}
|
||||
|
||||
@ObjectType()
|
||||
export class SessionReauthedAccountPlayload extends OmitType(
|
||||
SignedInAccountPayload,
|
||||
['sessionToken']
|
||||
) {}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
import { Field, ObjectType, ReturnTypeFunc } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class SignedUpAccountPayload {
|
||||
|
@ -11,13 +11,13 @@ export class SignedUpAccountPayload {
|
|||
})
|
||||
public clientMutationId?: string;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public uid!: hexstring;
|
||||
|
||||
@Field()
|
||||
@Field((type) => String)
|
||||
public sessionToken!: hexstring;
|
||||
|
||||
@Field({ nullable: true })
|
||||
@Field((type) => String, { nullable: true })
|
||||
keyFetchToken?: hexstring;
|
||||
|
||||
@Field()
|
||||
|
|
|
@ -19,7 +19,7 @@ export class SessionStatus {
|
|||
})
|
||||
public uid!: string;
|
||||
|
||||
@Field({
|
||||
@Field((type) => String, {
|
||||
description: 'Whether the current session is verified',
|
||||
})
|
||||
public state!: SessionVerifiedState;
|
||||
|
|
|
@ -20,7 +20,7 @@ import { DestroySessionInput } from './dto/input';
|
|||
import { BasicMutationInput } from './dto/input/basic-mutation';
|
||||
import { SessionReauthInput } from './dto/input/session-reauth';
|
||||
import { BasicPayload } from './dto/payload';
|
||||
import { SessionReauthedAccountPlayload } from './dto/payload/signed-in-account';
|
||||
import { SessionReauthedAccountPayload } from './dto/payload/session-reauthed-account';
|
||||
import { CatchGatewayError } from './lib/error';
|
||||
import { Session as SessionType, SessionStatus } from './model/session';
|
||||
import { SessionVerifyCodeInput } from './dto/input/session-verify-code';
|
||||
|
@ -65,14 +65,14 @@ export class SessionResolver {
|
|||
return { state, uid };
|
||||
}
|
||||
|
||||
@Mutation((returns) => SessionReauthedAccountPlayload, {
|
||||
@Mutation((returns) => SessionReauthedAccountPayload, {
|
||||
description: 'Re-authenticate an existing session token.',
|
||||
})
|
||||
@CatchGatewayError
|
||||
public async reauthSession(
|
||||
@GqlXHeaders() headers: Headers,
|
||||
@Args('input', { type: () => SessionReauthInput }) input: SessionReauthInput
|
||||
): Promise<SessionReauthedAccountPlayload> {
|
||||
): Promise<SessionReauthedAccountPayload> {
|
||||
const result = await this.authAPI.sessionReauthWithAuthPW(
|
||||
input.sessionToken,
|
||||
input.email,
|
||||
|
@ -108,16 +108,16 @@ export class SessionResolver {
|
|||
@UseGuards(GqlAuthGuard, GqlCustomsGuard)
|
||||
@CatchGatewayError
|
||||
public async verifyCode(
|
||||
@GqlSessionToken() token: string,
|
||||
@GqlXHeaders() headers: Headers,
|
||||
@Args('input', { type: () => SessionVerifyCodeInput })
|
||||
@GqlSessionToken() token: string,
|
||||
@GqlXHeaders() headers: Headers,
|
||||
@Args('input', { type: () => SessionVerifyCodeInput })
|
||||
input: SessionVerifyCodeInput
|
||||
): Promise<BasicPayload> {
|
||||
await this.authAPI.sessionVerifyCode(
|
||||
token,
|
||||
input.code,
|
||||
input.options,
|
||||
headers
|
||||
token,
|
||||
input.code,
|
||||
input.options,
|
||||
headers
|
||||
);
|
||||
return {
|
||||
clientMutationId: input.clientMutationId,
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [ "ts-jest", { "isolatedModules": true } ]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,5 @@
|
|||
"importHelpers": true,
|
||||
"types": ["../fxa-auth-client/lib/types", "mozlog", "jest"]
|
||||
},
|
||||
"references": [{ "path": "../fxa-shared" }, { "path": "../fxa-auth-client" }],
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
roots: ['<rootDir>/src'],
|
||||
transform: {
|
||||
'^.+\\.tsx?$': 'ts-jest',
|
||||
'^.+\\.tsx?$': [ "ts-jest", { "isolatedModules": true } ]
|
||||
},
|
||||
};
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
"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": "SKIP_PREFLIGHT_CHECK=true PUBLIC_URL=/ INLINE_RUNTIME_CHUNK=false rescripts test",
|
||||
"test:server": "jest --runInBand --coverage --verbose --config server/jest.config.js --forceExit",
|
||||
"test:unit": "yarn test",
|
||||
"test:server": "jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit",
|
||||
"test:unit": "yarn build && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-unit.xml jest --coverage --runInBand --logHeapUsage --verbose --config server/jest.config.js --forceExit --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": "start-storybook -p 6006",
|
||||
"build-storybook": "NODE_ENV=production npm run build-css && build-storybook && cp -r public/images storybook-static/",
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#!/bin/bash -ex
|
||||
|
||||
yarn workspaces focus fxa-payments-server
|
||||
yarn build
|
||||
NODE_ENV=test yarn test
|
||||
yarn workspace fxa-payments-server build
|
||||
NODE_ENV=test yarn workspace fxa-payments-server test
|
||||
|
|
|
@ -9,5 +9,7 @@ module.exports = {
|
|||
statements: 0,
|
||||
},
|
||||
},
|
||||
transform: { 'fxa-shared/.*': 'ts-jest' },
|
||||
transform: {
|
||||
"fxa-shared/*": [ "ts-jest", { "isolatedModules": true } ]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,14 +7,15 @@
|
|||
"lint": "eslint .",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"outdated": "npm outdated --depth 0 || exit 0",
|
||||
"start": "mkdir -p var/public && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:1111/__heartbeat__",
|
||||
"start": "yarn make-dirs && pm2 start pm2.config.js && ../../_scripts/check-url.sh localhost:1111/__heartbeat__",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "scripts/test-local.sh",
|
||||
"test:unit": "node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#unit' ",
|
||||
"test:integration": "node ./scripts/mocha-coverage.js --recursive test/*.js test/routes/*/*.js -g '#integration' ",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'"
|
||||
"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 '#unit'",
|
||||
"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"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hapi/boom": "~10.0.0",
|
||||
|
@ -66,5 +67,9 @@
|
|||
"bugs": "https://github.com/mozilla/fxa/issues",
|
||||
"homepage": "https://github.com/mozilla/fxa/tree/main/packages/fxa-profile-server",
|
||||
"author": "Sean McArthur <sean.monstar@gmail.com>",
|
||||
"license": "MPL-2.0"
|
||||
"license": "MPL-2.0",
|
||||
"mocha": {
|
||||
"reporter": "mocha-multi",
|
||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,13 @@
|
|||
|
||||
DIR=$(dirname "$0")
|
||||
|
||||
# make sure var/public exists
|
||||
mkdir -p var/public
|
||||
|
||||
# Copy version info
|
||||
cp "$DIR/../../version.json" "$DIR/../config"
|
||||
yarn workspaces focus fxa-profile-server
|
||||
|
||||
# Should not be necessary
|
||||
# yarn workspaces focus fxa-profile-server
|
||||
|
||||
NODE_ENV=test yarn test
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
"browser": true,
|
||||
"jest": true
|
||||
},
|
||||
"ignorePatterns": ["dist/**"],
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const { readdirSync, readFileSync, statSync } = require('fs');
|
||||
const { resolve } = require('path');
|
||||
|
||||
const FXA_REACT_IMPORT_REGEX = /import(?:["'\s]*[\w*{}\n\r\t, ]+from\s*)?["'\s].*(fxa-react\/components\/[\w\/.]+)["'\s].*$/gm;
|
||||
const FXA_REACT_IMPORT_REGEX =
|
||||
/import(?:["'\s]*[\w*{}\n\r\t, ]+from\s*)?["'\s].*(fxa-react\/components\/[\w\\/.]+)["'\s].*$/gm;
|
||||
|
||||
function eligibleFile(file) {
|
||||
return (
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
module.exports = {
|
||||
roots: ['<rootDir>'],
|
||||
transform: {
|
||||
'^.+\\.(ts|tsx)?$': 'ts-jest',
|
||||
'^.+\\.(ts|tsx)?$': ['ts-jest', { isolatedModules: true }],
|
||||
'^.+\\.svg$': '<rootDir>/svg-transform.js',
|
||||
},
|
||||
moduleNameMapper: {
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
"postinstall": "grunt merge-ftl &&../../_scripts/clone-l10n.sh fxa-react",
|
||||
"build-css": "tailwindcss -i ./styles/tailwind.css -o ./styles/tailwind.out.css",
|
||||
"build-storybook": "NODE_ENV=production npm run build-css && build-storybook",
|
||||
"build": "tsc --build && npm run merge-ftl",
|
||||
"build": "yarn compile && npm run merge-ftl",
|
||||
"compile": "tsc --build",
|
||||
"clean": "rimraf dist",
|
||||
"lint": "eslint . .storybook",
|
||||
"format": "prettier --write --config ../../_dev/.prettierrc '**'",
|
||||
|
@ -22,9 +23,9 @@
|
|||
"stop": "pm2 stop pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"storybook": "npm run build-css && start-storybook -p 6007 --no-version-updates",
|
||||
"test": "yarn merge-ftl:test && jest --runInBand --env=jest-environment-jsdom",
|
||||
"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 --ci --reporters=default --reporters=jest-junit ",
|
||||
"test:unit": "yarn test",
|
||||
"test:integration": "echo 'No integration tests present!'",
|
||||
"test:integration": "echo No integration tests present for $npm_package_name",
|
||||
"merge-ftl": "grunt merge-ftl",
|
||||
"merge-ftl:test": "grunt merge-ftl:test",
|
||||
"watch-ftl": "grunt watch-ftl"
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
"test": "yarn merge-ftl:test && SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false",
|
||||
"test:watch": "SKIP_PREFLIGHT_CHECK=true rescripts test",
|
||||
"test:coverage": "yarn test --coverage --watchAll=false",
|
||||
"test:unit": "yarn test",
|
||||
"test:integration": "echo 'No integration tests present!'",
|
||||
"test:unit": "echo No unit tests present for $npm_package_name",
|
||||
"test:integration": "yarn merge-ftl:test && JEST_JUNIT_OUTPUT_FILE=../../artifacts/tests/$npm_package_name/jest-integration.xml SKIP_PREFLIGHT_CHECK=true rescripts test --watchAll=false --ci --reporters=default --reporters=jest-junit",
|
||||
"merge-ftl": "grunt merge-ftl",
|
||||
"merge-ftl:test": "grunt merge-ftl:test",
|
||||
"watch-ftl": "grunt watch-ftl"
|
||||
|
|
|
@ -13,8 +13,7 @@ mkdir -p config
|
|||
cd ../../
|
||||
mkdir -p ~/.pm2/logs
|
||||
mkdir -p artifacts/tests
|
||||
node ./packages/db-migrations/bin/patcher.mjs
|
||||
yarn workspaces foreach \
|
||||
CI=true yarn workspaces foreach \
|
||||
--verbose \
|
||||
--topological-dev \
|
||||
--include 123done \
|
||||
|
@ -38,9 +37,9 @@ cd packages/fxa-content-server
|
|||
|
||||
node tests/intern.js \
|
||||
--suites="settings" \
|
||||
--output="../../artifacts/tests/results.xml" \
|
||||
--output="../../artifacts/tests/fxa-settings/intern-results.xml" \
|
||||
|| \
|
||||
node tests/intern.js \
|
||||
--suites="settings" \
|
||||
--output="../../artifacts/tests/results.xml" \
|
||||
--output="../../artifacts/tests/fxa-settings/intern-rerun-results.xml" \
|
||||
--grep="$(<rerun.txt)"
|
||||
|
|
|
@ -25,7 +25,7 @@ const clickConfirmUnlinkButton = async () => {
|
|||
fireEvent.click(confirmButton);
|
||||
});
|
||||
};
|
||||
describe('Linked Accounts', () => {
|
||||
describe('#integration - Linked Accounts', () => {
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
"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": "tsc --build && mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#unit'",
|
||||
"test:mocha:integration": "tsc --build && mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#unit' --invert",
|
||||
"test:jest": "jest --runInBand --coverage",
|
||||
"test:jest:unit": "jest --runInBand --coverage -t '#unit' ",
|
||||
"test:jest:integration": "jest --runInBand --coverage -t '#integration' ",
|
||||
"test:mocha:unit": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#unit'",
|
||||
"test:mocha:integration": "MOCHA_FILE=../../artifacts/tests/$npm_package_name/mocha-unit.xml mocha -r esbuild-register --recursive test/**/*.{js,ts} -g '#unit' --invert",
|
||||
"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 '#unit' --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 '**'"
|
||||
|
@ -118,6 +118,7 @@
|
|||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-fxa": "^2.0.2",
|
||||
"jest": "27.5.1",
|
||||
"jest-junit": "^15.0.0",
|
||||
"jsdom": "20.0.0",
|
||||
"jsdom-global": "3.0.2",
|
||||
"mocha": "^10.0.0",
|
||||
|
@ -169,7 +170,6 @@
|
|||
"class-validator": "^0.13.2",
|
||||
"cldr-localenames-full": "42.0.0",
|
||||
"cors": "^2.8.5",
|
||||
"db-migrations": "workspace:*",
|
||||
"express": "^4.17.3",
|
||||
"find-up": "^5.0.0",
|
||||
"generic-pool": "^3.8.2",
|
||||
|
@ -202,9 +202,18 @@
|
|||
"rootDir": "nestjs",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"isolatedModules": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"coverageDirectory": "../coverage",
|
||||
"testEnvironment": "node"
|
||||
},
|
||||
"mocha": {
|
||||
"reporter": "mocha-multi",
|
||||
"reporterOptions": "spec=-,mocha-junit-reporter=-"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,18 +9,20 @@
|
|||
"prebuild": "rimraf dist",
|
||||
"build": "nest build",
|
||||
"compile": "tsc --noEmit",
|
||||
"lint": "eslint *",
|
||||
"lint": "eslint .",
|
||||
"audit": "npm audit --json | audit-filter --nsp-config=.nsprc --audit=-",
|
||||
"watch": "tsc -w",
|
||||
"start": "pm2 start pm2.config.js",
|
||||
"stop": "pm2 stop pm2.config.js",
|
||||
"restart": "pm2 restart pm2.config.js",
|
||||
"delete": "pm2 delete pm2.config.js",
|
||||
"test": "jest --runInBand && 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",
|
||||
"test:e2e": "jest --runInBand --config ./test/jest-e2e.json"
|
||||
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r esbuild-register node_modules/.bin/jest --runInBand --logHeapUsage",
|
||||
"test:e2e": "jest --runInBand --config ./test/jest-e2e.json",
|
||||
"test:unit": "echo No unit tests present for $npm_package_name",
|
||||
"test:integration": "yarn test"
|
||||
},
|
||||
"private": true,
|
||||
"repository": {
|
||||
|
@ -87,7 +89,12 @@
|
|||
"rootDir": "src",
|
||||
"testRegex": ".spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [
|
||||
"ts-jest",
|
||||
{
|
||||
"isolatedModules": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"coverageDirectory": "./coverage",
|
||||
"testEnvironment": "node"
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
"testEnvironment": "node",
|
||||
"testRegex": ".e2e-spec.ts$",
|
||||
"transform": {
|
||||
"^.+\\.(t|j)s$": "ts-jest"
|
||||
"^.+\\.(t|j)s$": [ "ts-jest", { "isolatedModules": true } ]
|
||||
}
|
||||
}
|
||||
|
|
1145
yarn.lock
1145
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче