From d3f167460605d8e3b40c69454911a36ffeea41e7 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 22 Sep 2022 19:12:22 +0000 Subject: [PATCH 01/28] test(e2e): Set up test registry for E2E tests --- .github/workflows/build.yml | 29 ++++++++++++ e2e-tests/run.sh | 27 ++++++++++++ e2e-tests/verdaccio/conf/config.yaml | 66 ++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 e2e-tests/run.sh create mode 100644 e2e-tests/verdaccio/conf/config.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 49ae67cdf1e0..d81b33cf94aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -613,3 +613,32 @@ jobs: run: | cd packages/remix yarn test:integration:ci + + job_e2e_tests: + name: E2E Tests + needs: [job_get_metadata, job_build] + runs-on: ubuntu-latest + timeout-minutes: 10 + continue-on-error: true + steps: + - name: Check out current commit (${{ needs.job_get_metadata.outputs.commit_label }}) + uses: actions/checkout@v2 + with: + ref: ${{ env.HEAD_COMMIT }} + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: ${{ env.DEFAULT_NODE_VERSION }} + - name: Check dependency cache + uses: actions/cache@v2 + with: + path: ${{ env.CACHED_DEPENDENCY_PATHS }} + key: ${{ needs.job_build.outputs.dependency_cache_key }} + - name: Check build cache + uses: actions/cache@v2 + with: + path: ${{ env.CACHED_BUILD_PATHS }} + key: ${{ env.BUILD_CACHE_KEY }} + - name: Run integration tests + run: | + sh e2e-tests/run.sh diff --git a/e2e-tests/run.sh b/e2e-tests/run.sh new file mode 100644 index 000000000000..2ebda25bd5dc --- /dev/null +++ b/e2e-tests/run.sh @@ -0,0 +1,27 @@ +#!/bin/sh +set -e + +SCRIPT=$(readlink -f "$0") # Absolute path to this script +SCRIPT_DIR=$(dirname "$SCRIPT") # Absolute path of directory containing this script + +cd $SCRIPT_DIR/.. # Navigate to root of repository to build all the packages +yarn build:npm # create tarballs + +# Stop Verdaccio Test Registry container if it was already running - don't throw if container wasn't running +docker stop verdaccio-e2e-test-registry || true + +# Start Verdaccio Test Registry +docker run --detach --rm \ + --name verdaccio-e2e-test-registry \ + -p 4873:4873 \ + -v $SCRIPT_DIR/verdaccio/conf:/verdaccio/conf \ + verdaccio/verdaccio:5.15.3 + +# Publish built packages to Verdaccio Test Registry +for package in "$SCRIPT_DIR"/../packages/*/sentry-*.tgz; do + npm publish $package --registry http://localhost:4873 +done + +# TODO: Run e2e tests here + +docker stop verdaccio-e2e-test-registry diff --git a/e2e-tests/verdaccio/conf/config.yaml b/e2e-tests/verdaccio/conf/config.yaml new file mode 100644 index 000000000000..b50c4acaa301 --- /dev/null +++ b/e2e-tests/verdaccio/conf/config.yaml @@ -0,0 +1,66 @@ +# Taken from https://github.com/babel/babel/blob/624c78d99e8f42b2543b8943ab1b62bd71cf12d8/scripts/integration-tests/verdaccio-config.yml + +# +# This is the default config file. It allows all users to do anything, +# so don't use it on production systems. +# +# Look here for more config file examples: +# https://github.com/verdaccio/verdaccio/tree/master/conf +# + +# path to a directory with all packages +storage: /verdaccio/storage/data + +# https://verdaccio.org/docs/configuration#authentication +auth: + htpasswd: + file: /verdaccio/storage/htpasswd + +# https://verdaccio.org/docs/configuration#uplinks +# a list of other known repositories we can talk to +uplinks: + npmjs: + url: https://registry.npmjs.org/ + +# Learn how to protect your packages +# https://verdaccio.org/docs/protect-your-dependencies/ +# https://verdaccio.org/docs/configuration#packages +packages: + '@*/*': + # scoped packages + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '**': + # allow all users (including non-authenticated users) to read and + # publish all packages + # + # you can specify usernames/groupnames (depending on your auth plugin) + # and three keywords: "$all", "$anonymous", "$authenticated" + access: $all + + # allow all known users to publish/publish packages + # (anyone can register by default, remember?) + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + +# https://verdaccio.org/docs/configuration#server +# You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. +# A value of 0 makes the http server behave similarly to Node.js versions prior to 8.0.0, which did not have a keep-alive timeout. +# WORKAROUND: Through given configuration you can workaround following issue https://github.com/verdaccio/verdaccio/issues/301. Set to 0 in case 60 is not enough. +server: + keepAliveTimeout: 60 + +middlewares: + audit: + enabled: true + +# https://verdaccio.org/docs/logger +# log settings +logs: { type: stdout, format: pretty, level: http } +#experiments: +# # support for npm token command +# token: false From f9a0577bc6eb84f9cdfb8f35365bcde5d268cba1 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Thu, 22 Sep 2022 19:38:02 +0000 Subject: [PATCH 02/28] Use local npmrc to publish to test registry --- e2e-tests/.npmrc | 2 ++ e2e-tests/run.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 e2e-tests/.npmrc diff --git a/e2e-tests/.npmrc b/e2e-tests/.npmrc new file mode 100644 index 000000000000..9109d3a6935c --- /dev/null +++ b/e2e-tests/.npmrc @@ -0,0 +1,2 @@ +registry=http://localhost:4873/ +//localhost:4873/:_authToken=some-token diff --git a/e2e-tests/run.sh b/e2e-tests/run.sh index 2ebda25bd5dc..0a2e1a950f52 100644 --- a/e2e-tests/run.sh +++ b/e2e-tests/run.sh @@ -19,7 +19,7 @@ docker run --detach --rm \ # Publish built packages to Verdaccio Test Registry for package in "$SCRIPT_DIR"/../packages/*/sentry-*.tgz; do - npm publish $package --registry http://localhost:4873 + npm publish $package --userconfig $SCRIPT_DIR/.npmrc done # TODO: Run e2e tests here From 4e1d6d112d30c920693380005399b3a5728620df Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 07:37:39 +0000 Subject: [PATCH 03/28] Convert to TS script --- .github/workflows/build.yml | 3 +- e2e-tests/package.json | 13 ++ e2e-tests/run.sh | 27 ---- e2e-tests/run.ts | 48 +++++++ e2e-tests/{.npmrc => test-registry.npmrc} | 0 e2e-tests/yarn.lock | 167 ++++++++++++++++++++++ 6 files changed, 230 insertions(+), 28 deletions(-) create mode 100644 e2e-tests/package.json delete mode 100644 e2e-tests/run.sh create mode 100644 e2e-tests/run.ts rename e2e-tests/{.npmrc => test-registry.npmrc} (100%) create mode 100644 e2e-tests/yarn.lock diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d81b33cf94aa..6f1ac2472d36 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -641,4 +641,5 @@ jobs: key: ${{ env.BUILD_CACHE_KEY }} - name: Run integration tests run: | - sh e2e-tests/run.sh + cd e2e-tests + yarn start diff --git a/e2e-tests/package.json b/e2e-tests/package.json new file mode 100644 index 000000000000..7a2878ed8de6 --- /dev/null +++ b/e2e-tests/package.json @@ -0,0 +1,13 @@ +{ + "name": "@sentry-internal/e2e-tests", + "version": "0.0.0", + "license": "MIT", + "private": true, + "scripts": { + "start": "ts-node run.ts" + }, + "dependencies": { + "glob": "^8.0.3", + "ts-node": "^10.9.1" + } +} diff --git a/e2e-tests/run.sh b/e2e-tests/run.sh deleted file mode 100644 index 0a2e1a950f52..000000000000 --- a/e2e-tests/run.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -set -e - -SCRIPT=$(readlink -f "$0") # Absolute path to this script -SCRIPT_DIR=$(dirname "$SCRIPT") # Absolute path of directory containing this script - -cd $SCRIPT_DIR/.. # Navigate to root of repository to build all the packages -yarn build:npm # create tarballs - -# Stop Verdaccio Test Registry container if it was already running - don't throw if container wasn't running -docker stop verdaccio-e2e-test-registry || true - -# Start Verdaccio Test Registry -docker run --detach --rm \ - --name verdaccio-e2e-test-registry \ - -p 4873:4873 \ - -v $SCRIPT_DIR/verdaccio/conf:/verdaccio/conf \ - verdaccio/verdaccio:5.15.3 - -# Publish built packages to Verdaccio Test Registry -for package in "$SCRIPT_DIR"/../packages/*/sentry-*.tgz; do - npm publish $package --userconfig $SCRIPT_DIR/.npmrc -done - -# TODO: Run e2e tests here - -docker stop verdaccio-e2e-test-registry diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts new file mode 100644 index 000000000000..bf6309d58535 --- /dev/null +++ b/e2e-tests/run.ts @@ -0,0 +1,48 @@ +/* eslint-disable no-console */ +import * as childProcess from 'child_process'; +import * as path from 'path'; +import * as glob from 'glob'; + +const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; + +const repositoryRoot = path.resolve(__dirname, '..'); + +// Create tarballs +childProcess.execSync('yarn build:npm', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); + +try { + // Stop Verdaccio Test Registry container if it was already running + childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { stdio: 'ignore' }); + console.log('Stopped previously running test registry'); +} catch (e) { + // Don't throw if container wasn't running +} + +// Start Verdaccio Test Registry +childProcess.execSync( + `docker run --detach --rm --name verdaccio-e2e-test-registry -p 4873:4873 -v ${__dirname}/verdaccio/conf:/verdaccio/conf verdaccio/verdaccio:5.15.3`, + { encoding: 'utf8', stdio: 'inherit' }, +); + +// Publish built packages to Verdaccio Test Registry +const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { + cwd: repositoryRoot, + absolute: true, +}); +packageTarballPaths.forEach(tarballPath => { + childProcess.execSync(`npm publish ${tarballPath}`, { + env: { + NODE_ENV: 'production', + NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, + }, + encoding: 'utf8', + stdio: 'inherit', + cwd: __dirname, + }); +}); + +// TODO: Run e2e tests here + +// Stop test registry +childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); +console.log('Successfully stopped test registry container'); // Output from command above is not good so we ignore it and write our own diff --git a/e2e-tests/.npmrc b/e2e-tests/test-registry.npmrc similarity index 100% rename from e2e-tests/.npmrc rename to e2e-tests/test-registry.npmrc diff --git a/e2e-tests/yarn.lock b/e2e-tests/yarn.lock new file mode 100644 index 000000000000..e38a407ad6a4 --- /dev/null +++ b/e2e-tests/yarn.lock @@ -0,0 +1,167 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + +"@jridgewell/resolve-uri@^3.0.3": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" + integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== + +"@jridgewell/sourcemap-codec@^1.4.10": + version "1.4.14" + resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" + integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== + +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + +"@tsconfig/node10@^1.0.7": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" + integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + +"@tsconfig/node12@^1.0.7": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" + integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== + +"@tsconfig/node14@^1.0.0": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" + integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== + +"@tsconfig/node16@^1.0.2": + version "1.0.3" + resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" + integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== + +acorn-walk@^8.1.1: + version "8.2.0" + resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" + integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== + +acorn@^8.4.1: + version "8.8.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" + integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== + +arg@^4.1.0: + version "4.1.3" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" + integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== + +balanced-match@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" + integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== + +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + +create-require@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" + integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== + +diff@^4.0.1: + version "4.0.2" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" + integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== + +fs.realpath@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" + integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== + +glob@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + +inflight@^1.0.4: + version "1.0.6" + resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" + integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== + dependencies: + once "^1.3.0" + wrappy "1" + +inherits@2: + version "2.0.4" + resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" + integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== + +make-error@^1.1.1: + version "1.3.6" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" + integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== + +minimatch@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" + integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + dependencies: + brace-expansion "^2.0.1" + +once@^1.3.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== + dependencies: + wrappy "1" + +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + +v8-compile-cache-lib@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" + integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== + +yn@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== From 4bb74183ac6908abba4039790e3a24224d8109bc Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 11:18:42 +0000 Subject: [PATCH 04/28] Yarn install in workflow --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6f1ac2472d36..50daf1b11f31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -642,4 +642,5 @@ jobs: - name: Run integration tests run: | cd e2e-tests + yarn install --ignore-engines --frozen-lockfile yarn start From d206f82b894cdcb2a4cb5434ee79036508f22400 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 11:45:12 +0000 Subject: [PATCH 05/28] Remove cwd to fix CI? --- e2e-tests/run.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index bf6309d58535..a1b89451fc76 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -37,7 +37,6 @@ packageTarballPaths.forEach(tarballPath => { }, encoding: 'utf8', stdio: 'inherit', - cwd: __dirname, }); }); From 4996956bd04ad31686f963db2c2c878035ab985e Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 12:04:44 +0000 Subject: [PATCH 06/28] Remove node env to fix CI? --- e2e-tests/run.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index a1b89451fc76..45bdd0f53dbb 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -32,7 +32,6 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { packageTarballPaths.forEach(tarballPath => { childProcess.execSync(`npm publish ${tarballPath}`, { env: { - NODE_ENV: 'production', NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, }, encoding: 'utf8', From 923be2710bf5877487f70bceeae36966e8ddd6b4 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 12:23:09 +0000 Subject: [PATCH 07/28] Pass current env to fix CI? --- e2e-tests/run.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index 45bdd0f53dbb..4b6c9ad5fb0e 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -32,6 +32,7 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { packageTarballPaths.forEach(tarballPath => { childProcess.execSync(`npm publish ${tarballPath}`, { env: { + ...process.env, NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, }, encoding: 'utf8', From a904675d87df13063f91016d1f8784bb3c71aad4 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 12:41:42 +0000 Subject: [PATCH 08/28] Add registry flag to fix CI??? --- e2e-tests/run.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index 4b6c9ad5fb0e..a883e014eff1 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -30,7 +30,7 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { absolute: true, }); packageTarballPaths.forEach(tarballPath => { - childProcess.execSync(`npm publish ${tarballPath}`, { + childProcess.execSync(`npm publish ${tarballPath} --registry http://localhost:4873`, { env: { ...process.env, NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, @@ -43,5 +43,5 @@ packageTarballPaths.forEach(tarballPath => { // TODO: Run e2e tests here // Stop test registry -childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); +// childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); console.log('Successfully stopped test registry container'); // Output from command above is not good so we ignore it and write our own From c1537e16ff1ba600f080fb727bef481997adb86f Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 12:58:11 +0000 Subject: [PATCH 09/28] Omg just work --- e2e-tests/run.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index a883e014eff1..501d6b683c0e 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -30,7 +30,10 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { absolute: true, }); packageTarballPaths.forEach(tarballPath => { + // For some reason the auth token must be in the .npmrc, for some other reason the npm `--userconfig` flag doesn't work, + // and for some reason the registry must be passed via`--registry` :eye-roll: childProcess.execSync(`npm publish ${tarballPath} --registry http://localhost:4873`, { + cwd: __dirname, env: { ...process.env, NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, From 55e6561120ed57ec5a7c3c232f17e095e79e7181 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 13:00:05 +0000 Subject: [PATCH 10/28] Omg just work --- e2e-tests/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index 501d6b683c0e..22c7ca9850c2 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -46,5 +46,5 @@ packageTarballPaths.forEach(tarballPath => { // TODO: Run e2e tests here // Stop test registry -// childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); +childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); console.log('Successfully stopped test registry container'); // Output from command above is not good so we ignore it and write our own From 7c43399630439b904ad3d5fc0be21a761466a4ce Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Fri, 23 Sep 2022 13:15:47 +0000 Subject: [PATCH 11/28] Finally --- e2e-tests/run.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index 22c7ca9850c2..c2a11ad997a3 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -30,8 +30,9 @@ const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { absolute: true, }); packageTarballPaths.forEach(tarballPath => { - // For some reason the auth token must be in the .npmrc, for some other reason the npm `--userconfig` flag doesn't work, - // and for some reason the registry must be passed via`--registry` :eye-roll: + // For some reason the auth token must be in the .npmrc, for some reason the npm `--userconfig` flag doesn't work, + // and for some reason the registry must be passed via `--registry` AND in the .npmrc because different npm versions + // apparently work different and we want it to work with different npm versions because of local development. childProcess.execSync(`npm publish ${tarballPath} --registry http://localhost:4873`, { cwd: __dirname, env: { From 7cdc52715e34fd011a372e2dc3d49cdf89c630f5 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 08:16:00 +0000 Subject: [PATCH 12/28] Add individual packages to verdaccio config --- e2e-tests/verdaccio/conf/config.yaml | 124 ++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/e2e-tests/verdaccio/conf/config.yaml b/e2e-tests/verdaccio/conf/config.yaml index b50c4acaa301..7f944f424f9c 100644 --- a/e2e-tests/verdaccio/conf/config.yaml +++ b/e2e-tests/verdaccio/conf/config.yaml @@ -26,12 +26,132 @@ uplinks: # https://verdaccio.org/docs/protect-your-dependencies/ # https://verdaccio.org/docs/configuration#packages packages: + # To not use a proxy (e.g. npm) but instead use verdaccio for package hosting we need to define rules here without the + # `proxy` field. Sadly we can't use a wildcard like "@sentry/*" because we have some dependencies (@sentry/cli, + # @sentry/webpack-plugin) that fall under that wildcard but don't live in this repository. If we were to use that + # wildcard, we would get a 404 when attempting to install them, since they weren't uploaded to verdaccio, and also + # don't have a proxy configuration. + + '@sentry/angular': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/browser': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/core': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/ember': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/gatsby': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/hub': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/integrations': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/nextjs': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/node': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/react': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/remix': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/serverless': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/svelte': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/tracing': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/types': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/utils': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/vue': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry/wasm': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + + '@sentry-internal/*': + access: $all + publish: $all + unpublish: $all + # proxy: npmjs # Don't proxy for E2E tests! + '@*/*': # scoped packages access: $all publish: $all unpublish: $all - # proxy: npmjs # Don't proxy for E2E tests! + proxy: npmjs '**': # allow all users (including non-authenticated users) to read and @@ -45,7 +165,7 @@ packages: # (anyone can register by default, remember?) publish: $all unpublish: $all - # proxy: npmjs # Don't proxy for E2E tests! + proxy: npmjs # https://verdaccio.org/docs/configuration#server # You can specify HTTP/1.1 server keep alive timeout in seconds for incoming connections. From fc14bbba1e126baeefcee2c400b433b1860edfd2 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 08:16:24 +0000 Subject: [PATCH 13/28] Clean up dependencies? --- e2e-tests/package.json | 7 +++++-- e2e-tests/run.ts | 2 +- e2e-tests/tsconfig.json | 6 ++++++ e2e-tests/yarn.lock | 28 ++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 e2e-tests/tsconfig.json diff --git a/e2e-tests/package.json b/e2e-tests/package.json index 7a2878ed8de6..4ed5f26d733b 100644 --- a/e2e-tests/package.json +++ b/e2e-tests/package.json @@ -6,8 +6,11 @@ "scripts": { "start": "ts-node run.ts" }, - "dependencies": { + "devDependencies": { + "@types/glob": "^8.0.0", + "@types/node": "~10.17.0", "glob": "^8.0.3", - "ts-node": "^10.9.1" + "ts-node": "^10.9.1", + "typescript": "3.8.3" } } diff --git a/e2e-tests/run.ts b/e2e-tests/run.ts index c2a11ad997a3..8a12454769ac 100644 --- a/e2e-tests/run.ts +++ b/e2e-tests/run.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import * as childProcess from 'child_process'; -import * as path from 'path'; import * as glob from 'glob'; +import * as path from 'path'; const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; diff --git a/e2e-tests/tsconfig.json b/e2e-tests/tsconfig.json new file mode 100644 index 000000000000..df890c605435 --- /dev/null +++ b/e2e-tests/tsconfig.json @@ -0,0 +1,6 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "types": ["node"] + } +} diff --git a/e2e-tests/yarn.lock b/e2e-tests/yarn.lock index e38a407ad6a4..9cb00771c3a3 100644 --- a/e2e-tests/yarn.lock +++ b/e2e-tests/yarn.lock @@ -47,6 +47,29 @@ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== +"@types/glob@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" + integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + +"@types/minimatch@*": + version "5.1.2" + resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" + integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== + +"@types/node@*": + version "18.7.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.21.tgz#63ee6688070e456325b6748dc492a7b948593871" + integrity sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA== + +"@types/node@~10.17.0": + version "10.17.60" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" + integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== + acorn-walk@^8.1.1: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" @@ -151,6 +174,11 @@ ts-node@^10.9.1: v8-compile-cache-lib "^3.0.1" yn "3.1.1" +typescript@3.8.3: + version "3.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" + integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== + v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" From 5c9e8ed79624dde2e1f1d5d45a4cffbb1617141a Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 08:40:04 +0000 Subject: [PATCH 14/28] Move e2e tests into workspace --- .github/workflows/build.yml | 5 +- e2e-tests/yarn.lock | 195 ------------------ package.json | 1 + .../e2e-tests}/package.json | 2 +- {e2e-tests => packages/e2e-tests}/run.ts | 29 +-- .../e2e-tests}/test-registry.npmrc | 0 .../e2e-tests}/tsconfig.json | 2 +- .../e2e-tests}/verdaccio/conf/config.yaml | 0 yarn.lock | 69 ++++++- 9 files changed, 89 insertions(+), 214 deletions(-) delete mode 100644 e2e-tests/yarn.lock rename {e2e-tests => packages/e2e-tests}/package.json (89%) rename {e2e-tests => packages/e2e-tests}/run.ts (69%) rename {e2e-tests => packages/e2e-tests}/test-registry.npmrc (100%) rename {e2e-tests => packages/e2e-tests}/tsconfig.json (59%) rename {e2e-tests => packages/e2e-tests}/verdaccio/conf/config.yaml (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 50daf1b11f31..1271bb17ad29 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -641,6 +641,5 @@ jobs: key: ${{ env.BUILD_CACHE_KEY }} - name: Run integration tests run: | - cd e2e-tests - yarn install --ignore-engines --frozen-lockfile - yarn start + cd packages/e2e-tests + yarn test:e2e diff --git a/e2e-tests/yarn.lock b/e2e-tests/yarn.lock deleted file mode 100644 index 9cb00771c3a3..000000000000 --- a/e2e-tests/yarn.lock +++ /dev/null @@ -1,195 +0,0 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. -# yarn lockfile v1 - - -"@cspotcode/source-map-support@^0.8.0": - version "0.8.1" - resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" - integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== - dependencies: - "@jridgewell/trace-mapping" "0.3.9" - -"@jridgewell/resolve-uri@^3.0.3": - version "3.1.0" - resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78" - integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w== - -"@jridgewell/sourcemap-codec@^1.4.10": - version "1.4.14" - resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz#add4c98d341472a289190b424efbdb096991bb24" - integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== - -"@jridgewell/trace-mapping@0.3.9": - version "0.3.9" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" - integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== - dependencies: - "@jridgewell/resolve-uri" "^3.0.3" - "@jridgewell/sourcemap-codec" "^1.4.10" - -"@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== - -"@tsconfig/node12@^1.0.7": - version "1.0.11" - resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d" - integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag== - -"@tsconfig/node14@^1.0.0": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1" - integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow== - -"@tsconfig/node16@^1.0.2": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.3.tgz#472eaab5f15c1ffdd7f8628bd4c4f753995ec79e" - integrity sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ== - -"@types/glob@^8.0.0": - version "8.0.0" - resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" - integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - -"@types/minimatch@*": - version "5.1.2" - resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-5.1.2.tgz#07508b45797cb81ec3f273011b054cd0755eddca" - integrity sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA== - -"@types/node@*": - version "18.7.21" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.21.tgz#63ee6688070e456325b6748dc492a7b948593871" - integrity sha512-rLFzK5bhM0YPyCoTC8bolBjMk7bwnZ8qeZUBslBfjZQou2ssJdWslx9CZ8DGM+Dx7QXQiiTVZ/6QO6kwtHkZCA== - -"@types/node@~10.17.0": - version "10.17.60" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" - integrity sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw== - -acorn-walk@^8.1.1: - version "8.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" - integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== - -acorn@^8.4.1: - version "8.8.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.8.0.tgz#88c0187620435c7f6015803f5539dae05a9dbea8" - integrity sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w== - -arg@^4.1.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" - integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== - -balanced-match@^1.0.0: - version "1.0.2" - resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" - integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== - -brace-expansion@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" - integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== - dependencies: - balanced-match "^1.0.0" - -create-require@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" - integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== - -diff@^4.0.1: - version "4.0.2" - resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" - integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== - -fs.realpath@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" - integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== - -glob@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" - integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - -inflight@^1.0.4: - version "1.0.6" - resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" - integrity sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA== - dependencies: - once "^1.3.0" - wrappy "1" - -inherits@2: - version "2.0.4" - resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" - integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== - -make-error@^1.1.1: - version "1.3.6" - resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" - integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== - -minimatch@^5.0.1: - version "5.1.0" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" - integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== - dependencies: - brace-expansion "^2.0.1" - -once@^1.3.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" - integrity sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w== - dependencies: - wrappy "1" - -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== - dependencies: - "@cspotcode/source-map-support" "^0.8.0" - "@tsconfig/node10" "^1.0.7" - "@tsconfig/node12" "^1.0.7" - "@tsconfig/node14" "^1.0.0" - "@tsconfig/node16" "^1.0.2" - acorn "^8.4.1" - acorn-walk "^8.1.1" - arg "^4.1.0" - create-require "^1.1.0" - diff "^4.0.1" - make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" - yn "3.1.1" - -typescript@3.8.3: - version "3.8.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" - integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== - -v8-compile-cache-lib@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" - integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== - -wrappy@1: - version "1.0.2" - resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" - integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== - -yn@3.1.1: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" - integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/package.json b/package.json index 19b1888e6dcc..4c1239c7b8ce 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "packages/angular", "packages/browser", "packages/core", + "packages/e2e-tests", "packages/ember", "packages/eslint-config-sdk", "packages/eslint-plugin-sdk", diff --git a/e2e-tests/package.json b/packages/e2e-tests/package.json similarity index 89% rename from e2e-tests/package.json rename to packages/e2e-tests/package.json index 4ed5f26d733b..ca1a05adb57f 100644 --- a/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -4,7 +4,7 @@ "license": "MIT", "private": true, "scripts": { - "start": "ts-node run.ts" + "test:e2e": "ts-node run.ts" }, "devDependencies": { "@types/glob": "^8.0.0", diff --git a/e2e-tests/run.ts b/packages/e2e-tests/run.ts similarity index 69% rename from e2e-tests/run.ts rename to packages/e2e-tests/run.ts index 8a12454769ac..ff206fb807e3 100644 --- a/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -5,7 +5,7 @@ import * as path from 'path'; const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; -const repositoryRoot = path.resolve(__dirname, '..'); +const repositoryRoot = path.resolve(__dirname, '../..'); // Create tarballs childProcess.execSync('yarn build:npm', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); @@ -18,34 +18,37 @@ try { // Don't throw if container wasn't running } -// Start Verdaccio Test Registry +// Start Verdaccio childProcess.execSync( `docker run --detach --rm --name verdaccio-e2e-test-registry -p 4873:4873 -v ${__dirname}/verdaccio/conf:/verdaccio/conf verdaccio/verdaccio:5.15.3`, { encoding: 'utf8', stdio: 'inherit' }, ); -// Publish built packages to Verdaccio Test Registry +// Publish built packages to Verdaccio const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { cwd: repositoryRoot, absolute: true, }); packageTarballPaths.forEach(tarballPath => { - // For some reason the auth token must be in the .npmrc, for some reason the npm `--userconfig` flag doesn't work, + // For some reason the auth token must be in the .npmrc, for some reason the npm `--userconfig` flag doesn't always work, // and for some reason the registry must be passed via `--registry` AND in the .npmrc because different npm versions // apparently work different and we want it to work with different npm versions because of local development. - childProcess.execSync(`npm publish ${tarballPath} --registry http://localhost:4873`, { - cwd: __dirname, - env: { - ...process.env, - NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, + childProcess.execSync( + `npm publish ${tarballPath} --registry http://localhost:4873 --userconfig ${__dirname}/test-registry.npmrc`, + { + cwd: repositoryRoot, // Can't use __dirname here because npm would try to publish `@sentry-internal/e2e-tests` + env: { + ...process.env, + NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, + }, + encoding: 'utf8', + stdio: 'inherit', }, - encoding: 'utf8', - stdio: 'inherit', - }); + ); }); // TODO: Run e2e tests here // Stop test registry childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { encoding: 'utf8', stdio: 'ignore' }); -console.log('Successfully stopped test registry container'); // Output from command above is not good so we ignore it and write our own +console.log('Successfully stopped test registry container'); // Output from command above is not good so we `ignore` it and emit our own diff --git a/e2e-tests/test-registry.npmrc b/packages/e2e-tests/test-registry.npmrc similarity index 100% rename from e2e-tests/test-registry.npmrc rename to packages/e2e-tests/test-registry.npmrc diff --git a/e2e-tests/tsconfig.json b/packages/e2e-tests/tsconfig.json similarity index 59% rename from e2e-tests/tsconfig.json rename to packages/e2e-tests/tsconfig.json index df890c605435..2e051315981a 100644 --- a/e2e-tests/tsconfig.json +++ b/packages/e2e-tests/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.json", + "extends": "../../tsconfig.json", "compilerOptions": { "types": ["node"] } diff --git a/e2e-tests/verdaccio/conf/config.yaml b/packages/e2e-tests/verdaccio/conf/config.yaml similarity index 100% rename from e2e-tests/verdaccio/conf/config.yaml rename to packages/e2e-tests/verdaccio/conf/config.yaml diff --git a/yarn.lock b/yarn.lock index e2215f03ff14..a383e46f475f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2524,6 +2524,13 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" +"@cspotcode/source-map-support@^0.8.0": + version "0.8.1" + resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" + integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw== + dependencies: + "@jridgewell/trace-mapping" "0.3.9" + "@ember-data/rfc395-data@^0.0.4": version "0.0.4" resolved "https://registry.yarnpkg.com/@ember-data/rfc395-data/-/rfc395-data-0.0.4.tgz#ecb86efdf5d7733a76ff14ea651a1b0ed1f8a843" @@ -3286,6 +3293,14 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.11.tgz#771a1d8d744eeb71b6adb35808e1a6c7b9b8c8ec" integrity sha512-Fg32GrJo61m+VqYSdRSjRXMjQ06j8YIYfcTqndLYVAaHmroZHLJZCydsWBOTDqXS2v+mjxohBWEMfg97GXmYQg== +"@jridgewell/trace-mapping@0.3.9": + version "0.3.9" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9" + integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ== + dependencies: + "@jridgewell/resolve-uri" "^3.0.3" + "@jridgewell/sourcemap-codec" "^1.4.10" + "@jridgewell/trace-mapping@^0.3.0": version "0.3.4" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.4.tgz#f6a0832dffd5b8a6aaa633b7d9f8e8e94c83a0c3" @@ -5153,6 +5168,14 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/glob@^8.0.0": + version "8.0.0" + resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" + integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== + dependencies: + "@types/minimatch" "*" + "@types/node" "*" + "@types/graceful-fs@^4.1.2": version "4.1.5" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.5.tgz#21ffba0d98da4350db64891f92a9e5db3cdb4e15" @@ -7962,6 +7985,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^2.3.1, braces@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.2.tgz#5979fd3f14cd531565e5fa2df1abfff1dfaee729" @@ -14150,6 +14180,17 @@ glob@^5.0.10, glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + global-dirs@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.0.tgz#70a76fe84ea315ab37b1f5576cbde7d48ef72686" @@ -18571,6 +18612,13 @@ minimalistic-crypto-utils@^1.0.1: dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" + integrity sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg== + dependencies: + brace-expansion "^2.0.1" + minimist-options@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/minimist-options/-/minimist-options-4.1.0.tgz#c0655713c53a8a2ebd77ffa247d342c40f010619" @@ -25281,6 +25329,25 @@ ts-node@^10.7.0: v8-compile-cache-lib "^3.0.0" yn "3.1.1" +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + ts-pnp@^1.1.6: version "1.2.0" resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92" @@ -25936,7 +26003,7 @@ uuid@^8.0.0, uuid@^8.3.0, uuid@^8.3.1, uuid@^8.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2" integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg== -v8-compile-cache-lib@^3.0.0: +v8-compile-cache-lib@^3.0.0, v8-compile-cache-lib@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== From ea0155ff77a82e400a832c63ef8c7388bfdc75cc Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 08:43:30 +0000 Subject: [PATCH 15/28] Rename verdaccio config folder --- packages/e2e-tests/run.ts | 8 ++++---- .../{verdaccio/conf => verdaccio-config}/config.yaml | 0 2 files changed, 4 insertions(+), 4 deletions(-) rename packages/e2e-tests/{verdaccio/conf => verdaccio-config}/config.yaml (100%) diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index ff206fb807e3..64b022bd22bc 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -11,20 +11,20 @@ const repositoryRoot = path.resolve(__dirname, '../..'); childProcess.execSync('yarn build:npm', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); try { - // Stop Verdaccio Test Registry container if it was already running + // Stop test registry container (Verdaccio) if it was already running childProcess.execSync(`docker stop ${TEST_REGISTRY_CONTAINER_NAME}`, { stdio: 'ignore' }); console.log('Stopped previously running test registry'); } catch (e) { // Don't throw if container wasn't running } -// Start Verdaccio +// Start test registry (Verdaccio) childProcess.execSync( - `docker run --detach --rm --name verdaccio-e2e-test-registry -p 4873:4873 -v ${__dirname}/verdaccio/conf:/verdaccio/conf verdaccio/verdaccio:5.15.3`, + `docker run --detach --rm --name verdaccio-e2e-test-registry -p 4873:4873 -v ${__dirname}/verdaccio-config:/verdaccio/conf verdaccio/verdaccio:5.15.3`, { encoding: 'utf8', stdio: 'inherit' }, ); -// Publish built packages to Verdaccio +// Publish built packages to test registry const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { cwd: repositoryRoot, absolute: true, diff --git a/packages/e2e-tests/verdaccio/conf/config.yaml b/packages/e2e-tests/verdaccio-config/config.yaml similarity index 100% rename from packages/e2e-tests/verdaccio/conf/config.yaml rename to packages/e2e-tests/verdaccio-config/config.yaml From c16a10370d9b0ef678a17982d6a9f41cd819c53b Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:08:38 +0000 Subject: [PATCH 16/28] Extract verdaccio version into const --- packages/e2e-tests/run.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index 64b022bd22bc..28635e981046 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -4,6 +4,7 @@ import * as glob from 'glob'; import * as path from 'path'; const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; +const VERDACCIO_VERSION = '5.15.3'; const repositoryRoot = path.resolve(__dirname, '../..'); @@ -20,7 +21,7 @@ try { // Start test registry (Verdaccio) childProcess.execSync( - `docker run --detach --rm --name verdaccio-e2e-test-registry -p 4873:4873 -v ${__dirname}/verdaccio-config:/verdaccio/conf verdaccio/verdaccio:5.15.3`, + `docker run --detach --rm --name ${TEST_REGISTRY_CONTAINER_NAME} -p 4873:4873 -v ${__dirname}/verdaccio-config:/verdaccio/conf verdaccio/verdaccio:${VERDACCIO_VERSION}`, { encoding: 'utf8', stdio: 'inherit' }, ); From 519f598b8d79db0d4c8823fea476a2a0627eb8a3 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:09:01 +0000 Subject: [PATCH 17/28] Rename ci step --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1271bb17ad29..aebb3280e0ac 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -639,7 +639,7 @@ jobs: with: path: ${{ env.CACHED_BUILD_PATHS }} key: ${{ env.BUILD_CACHE_KEY }} - - name: Run integration tests + - name: Run E2E tests run: | cd packages/e2e-tests yarn test:e2e From 0709dd66208f801a4c18e162b1c1e7f1ab4aa325 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:29:28 +0000 Subject: [PATCH 18/28] Add license --- packages/e2e-tests/LICENSE | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 packages/e2e-tests/LICENSE diff --git a/packages/e2e-tests/LICENSE b/packages/e2e-tests/LICENSE new file mode 100644 index 000000000000..81b248b1b42e --- /dev/null +++ b/packages/e2e-tests/LICENSE @@ -0,0 +1,29 @@ +MIT License + +Copyright (c) 2022, Sentry +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 8eb8cc7a6a4c92c92a500133669d351ab0840337 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:29:55 +0000 Subject: [PATCH 19/28] Remove node types --- packages/e2e-tests/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index ca1a05adb57f..9412673c87e2 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -8,7 +8,6 @@ }, "devDependencies": { "@types/glob": "^8.0.0", - "@types/node": "~10.17.0", "glob": "^8.0.3", "ts-node": "^10.9.1", "typescript": "3.8.3" From ea33b5fe8273cc4ba7124807cbc81833416e0191 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:30:46 +0000 Subject: [PATCH 20/28] Turn off npm audit in verdaccio config --- packages/e2e-tests/verdaccio-config/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/verdaccio-config/config.yaml b/packages/e2e-tests/verdaccio-config/config.yaml index 7f944f424f9c..d0e5eab87ddf 100644 --- a/packages/e2e-tests/verdaccio-config/config.yaml +++ b/packages/e2e-tests/verdaccio-config/config.yaml @@ -176,7 +176,7 @@ server: middlewares: audit: - enabled: true + enabled: false # https://verdaccio.org/docs/logger # log settings From 25335fb24e1b8a9b27cc7eede8021088c019c9bd Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:38:22 +0000 Subject: [PATCH 21/28] Add lint command --- packages/e2e-tests/.eslintrc.js | 11 +++++++++++ packages/e2e-tests/package.json | 8 +++++++- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/e2e-tests/.eslintrc.js diff --git a/packages/e2e-tests/.eslintrc.js b/packages/e2e-tests/.eslintrc.js new file mode 100644 index 000000000000..7066f43bde55 --- /dev/null +++ b/packages/e2e-tests/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + env: { + browser: true, + node: true, + }, + extends: ['../../.eslintrc.js'], + ignorePatterns: ['suites/**/subject.js', 'suites/**/dist/*'], + parserOptions: { + sourceType: 'module', + }, +}; diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 9412673c87e2..23cc5e2c463b 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -4,7 +4,13 @@ "license": "MIT", "private": true, "scripts": { - "test:e2e": "ts-node run.ts" + "test:e2e": "ts-node run.ts", + "fix": "run-s fix:eslint fix:prettier", + "fix:eslint": "eslint . --format stylish --fix", + "fix:prettier": "prettier --config ../../.prettierrc.json --write . ", + "lint": "run-s lint:prettier lint:eslint", + "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", + "lint:prettier": "prettier --config ../../.prettierrc.json --check ." }, "devDependencies": { "@types/glob": "^8.0.0", From 432c850449272ce489eb32d889109abb219b46ad Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 09:50:42 +0000 Subject: [PATCH 22/28] Add yaml package and pin deps --- packages/e2e-tests/package.json | 9 +++--- yarn.lock | 53 ++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 28 deletions(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 23cc5e2c463b..c0566a8e4c11 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -13,9 +13,10 @@ "lint:prettier": "prettier --config ../../.prettierrc.json --check ." }, "devDependencies": { - "@types/glob": "^8.0.0", - "glob": "^8.0.3", - "ts-node": "^10.9.1", - "typescript": "3.8.3" + "@types/glob": "8.0.0", + "glob": "8.0.3", + "ts-node": "10.9.1", + "typescript": "3.8.3", + "yaml": "2.1.1" } } diff --git a/yarn.lock b/yarn.lock index a383e46f475f..8233926a6fa5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5168,7 +5168,7 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/glob@^8.0.0": +"@types/glob@8.0.0": version "8.0.0" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== @@ -14169,6 +14169,17 @@ glob@7.2.0, glob@^7.0.0, glob@^7.0.3, glob@^7.0.4, glob@^7.0.5, glob@^7.1.1, glo once "^1.3.0" path-is-absolute "^1.0.0" +glob@8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" + integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^5.0.1" + once "^1.3.0" + glob@^5.0.10, glob@^5.0.15: version "5.0.15" resolved "https://registry.yarnpkg.com/glob/-/glob-5.0.15.tgz#1bc936b9e02f4a603fcc222ecf7633d30b8b93b1" @@ -14180,17 +14191,6 @@ glob@^5.0.10, glob@^5.0.15: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.3: - version "8.0.3" - resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" - integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== - dependencies: - fs.realpath "^1.0.0" - inflight "^1.0.4" - inherits "2" - minimatch "^5.0.1" - once "^1.3.0" - global-dirs@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/global-dirs/-/global-dirs-3.0.0.tgz#70a76fe84ea315ab37b1f5576cbde7d48ef72686" @@ -25310,12 +25310,12 @@ ts-jest@^27.1.4: semver "7.x" yargs-parser "20.x" -ts-node@^10.7.0: - version "10.7.0" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" - integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== +ts-node@10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== dependencies: - "@cspotcode/source-map-support" "0.7.0" + "@cspotcode/source-map-support" "^0.8.0" "@tsconfig/node10" "^1.0.7" "@tsconfig/node12" "^1.0.7" "@tsconfig/node14" "^1.0.0" @@ -25326,15 +25326,15 @@ ts-node@^10.7.0: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" - v8-compile-cache-lib "^3.0.0" + v8-compile-cache-lib "^3.0.1" yn "3.1.1" -ts-node@^10.9.1: - version "10.9.1" - resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" - integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== +ts-node@^10.7.0: + version "10.7.0" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.7.0.tgz#35d503d0fab3e2baa672a0e94f4b40653c2463f5" + integrity sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A== dependencies: - "@cspotcode/source-map-support" "^0.8.0" + "@cspotcode/source-map-support" "0.7.0" "@tsconfig/node10" "^1.0.7" "@tsconfig/node12" "^1.0.7" "@tsconfig/node14" "^1.0.0" @@ -25345,7 +25345,7 @@ ts-node@^10.9.1: create-require "^1.1.0" diff "^4.0.1" make-error "^1.1.1" - v8-compile-cache-lib "^3.0.1" + v8-compile-cache-lib "^3.0.0" yn "3.1.1" ts-pnp@^1.1.6: @@ -26908,6 +26908,11 @@ yam@^1.0.0: fs-extra "^4.0.2" lodash.merge "^4.6.0" +yaml@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.1.1.tgz#1e06fb4ca46e60d9da07e4f786ea370ed3c3cfec" + integrity sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw== + yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" From 1904a06e553e26d3fd06b84e65c8d982979ad85a Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 10:21:28 +0000 Subject: [PATCH 23/28] Add quick validation script --- packages/e2e-tests/package.json | 11 ++++-- .../validate-verdaccio-configuration.ts | 37 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 packages/e2e-tests/validate-verdaccio-configuration.ts diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index c0566a8e4c11..ecfc217aa901 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,16 +1,21 @@ { "name": "@sentry-internal/e2e-tests", - "version": "0.0.0", + "version": "7.13.0", "license": "MIT", + "engines": { + "node": ">=10" + }, "private": true, "scripts": { - "test:e2e": "ts-node run.ts", "fix": "run-s fix:eslint fix:prettier", "fix:eslint": "eslint . --format stylish --fix", "fix:prettier": "prettier --config ../../.prettierrc.json --write . ", "lint": "run-s lint:prettier lint:eslint", "lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish", - "lint:prettier": "prettier --config ../../.prettierrc.json --check ." + "lint:prettier": "prettier --config ../../.prettierrc.json --check .", + "test:e2e": "run-s test:validate-configuration test:run", + "test:run": "ts-node run.ts", + "test:validate-configuration": "ts-node validate-verdaccio-configuration.ts" }, "devDependencies": { "@types/glob": "8.0.0", diff --git a/packages/e2e-tests/validate-verdaccio-configuration.ts b/packages/e2e-tests/validate-verdaccio-configuration.ts new file mode 100644 index 000000000000..b26b5fcf1f01 --- /dev/null +++ b/packages/e2e-tests/validate-verdaccio-configuration.ts @@ -0,0 +1,37 @@ +import * as assert from 'assert'; +import * as fs from 'fs'; +import * as glob from 'glob'; +import * as path from 'path'; +import * as YAML from 'yaml'; + +/* + * This file is a quick automatic check to confirm that the packages in the Verdaccio configuration always match the + * packages we defined in our monorepo. This is to ensure that the E2E tests do not use the packages that live on NPM + * but the local ones instead. + */ + +const repositoryRoot = path.resolve(__dirname, '../..'); + +const verdaccioConfigContent = fs.readFileSync('./verdaccio-config/config.yaml', { encoding: 'utf8' }); +const verdaccioConfig = YAML.parse(verdaccioConfigContent); +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +const sentryScopedPackagesInVerdaccioConfig = Object.keys(verdaccioConfig.packages).filter(packageName => + packageName.startsWith('@sentry/'), +); + +const packageJsonPaths = glob.sync('packages/*/package.json', { + cwd: repositoryRoot, + absolute: true, +}); +const packageJsons = packageJsonPaths.map(packageJsonPath => require(packageJsonPath)); +const sentryScopedPackageNames = packageJsons + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + .filter(packageJson => packageJson.name.startsWith('@sentry/')) + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access + .map(packageJson => packageJson.name); + +const mergedSize = new Set([...sentryScopedPackagesInVerdaccioConfig, ...sentryScopedPackageNames]).size; +assert.ok( + mergedSize === sentryScopedPackagesInVerdaccioConfig.length && mergedSize === sentryScopedPackageNames.length, + 'Packages in Verdaccio configuration do not match the "@sentry"-scoped packages in monorepo. Make sure they match!', +); From a7c5664b8557685edef8565be543c9e15a8cbb53 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 12:36:47 +0000 Subject: [PATCH 24/28] Containerize the process of publishing packages to fake registry --- .github/workflows/build.yml | 2 + .../e2e-tests/Dockerfile.publish-packages | 6 +++ packages/e2e-tests/publish-packages.ts | 25 ++++++++++ packages/e2e-tests/run.ts | 49 +++++++++---------- packages/e2e-tests/test-registry.npmrc | 3 +- 5 files changed, 58 insertions(+), 27 deletions(-) create mode 100644 packages/e2e-tests/Dockerfile.publish-packages create mode 100644 packages/e2e-tests/publish-packages.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aebb3280e0ac..dd1531632eb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -640,6 +640,8 @@ jobs: path: ${{ env.CACHED_BUILD_PATHS }} key: ${{ env.BUILD_CACHE_KEY }} - name: Run E2E tests + env: + E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION: ${{ env.DEFAULT_NODE_VERSION }} run: | cd packages/e2e-tests yarn test:e2e diff --git a/packages/e2e-tests/Dockerfile.publish-packages b/packages/e2e-tests/Dockerfile.publish-packages new file mode 100644 index 000000000000..e9b6eac59741 --- /dev/null +++ b/packages/e2e-tests/Dockerfile.publish-packages @@ -0,0 +1,6 @@ +# This Dockerfile exists for the purpose of using a specific node/npm version (ie. the same we use in CI) to run npm publish with +ARG NODE_VERSION=16.15.1 +FROM node:${NODE_VERSION} + +WORKDIR /sentry-javascript/packages/e2e-tests +CMD [ "yarn", "ts-node", "publish-packages.ts" ] diff --git a/packages/e2e-tests/publish-packages.ts b/packages/e2e-tests/publish-packages.ts new file mode 100644 index 000000000000..38a034d7e9eb --- /dev/null +++ b/packages/e2e-tests/publish-packages.ts @@ -0,0 +1,25 @@ +/* eslint-disable no-console */ +import * as childProcess from 'child_process'; +import * as glob from 'glob'; +import * as path from 'path'; + +const repositoryRoot = path.resolve(__dirname, '../..'); + +// Create tarballs +childProcess.execSync('yarn build:npm', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); + +// Get absolute paths of all the packages we want to publish to the fake registry +const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { + cwd: repositoryRoot, + absolute: true, +}); + +// Publish built packages to the fake registry +packageTarballPaths.forEach(tarballPath => { + // `--userconfig` flag needs to be before `publish` + childProcess.execSync(`npm --userconfig ${__dirname}/test-registry.npmrc publish ${tarballPath}`, { + cwd: repositoryRoot, // Can't use __dirname here because npm would try to publish `@sentry-internal/e2e-tests` + encoding: 'utf8', + stdio: 'inherit', + }); +}); diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index 28635e981046..263a2f4d02dd 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -1,15 +1,15 @@ /* eslint-disable no-console */ import * as childProcess from 'child_process'; -import * as glob from 'glob'; import * as path from 'path'; +const repositoryRoot = path.resolve(__dirname, '../..'); + const TEST_REGISTRY_CONTAINER_NAME = 'verdaccio-e2e-test-registry'; const VERDACCIO_VERSION = '5.15.3'; -const repositoryRoot = path.resolve(__dirname, '../..'); +const PUBLISH_PACKAGES_DOCKER_IMAGE_NAME = 'publish-packages'; -// Create tarballs -childProcess.execSync('yarn build:npm', { encoding: 'utf8', cwd: repositoryRoot, stdio: 'inherit' }); +const publishScriptNodeVersion = process.env.E2E_TEST_PUBLISH_SCRIPT_NODE_VERSION; try { // Stop test registry container (Verdaccio) if it was already running @@ -25,28 +25,25 @@ childProcess.execSync( { encoding: 'utf8', stdio: 'inherit' }, ); -// Publish built packages to test registry -const packageTarballPaths = glob.sync('packages/*/sentry-*.tgz', { - cwd: repositoryRoot, - absolute: true, -}); -packageTarballPaths.forEach(tarballPath => { - // For some reason the auth token must be in the .npmrc, for some reason the npm `--userconfig` flag doesn't always work, - // and for some reason the registry must be passed via `--registry` AND in the .npmrc because different npm versions - // apparently work different and we want it to work with different npm versions because of local development. - childProcess.execSync( - `npm publish ${tarballPath} --registry http://localhost:4873 --userconfig ${__dirname}/test-registry.npmrc`, - { - cwd: repositoryRoot, // Can't use __dirname here because npm would try to publish `@sentry-internal/e2e-tests` - env: { - ...process.env, - NPM_CONFIG_USERCONFIG: `${__dirname}/test-registry.npmrc`, - }, - encoding: 'utf8', - stdio: 'inherit', - }, - ); -}); +// Build container image that is uploading our packages to fake registry with specific Node.js/npm version +childProcess.execSync( + `docker build --tag ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME} --file ./Dockerfile.publish-packages ${ + publishScriptNodeVersion ? `--build-arg NODE_VERSION=${publishScriptNodeVersion}` : '' + } .`, + { + encoding: 'utf8', + stdio: 'inherit', + }, +); + +// Run container that uploads our packages to fake registry +childProcess.execSync( + `docker run --sig-proxy=true -it --rm -v ${repositoryRoot}:/sentry-javascript --network host ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME}`, + { + encoding: 'utf8', + stdio: 'inherit', + }, +); // TODO: Run e2e tests here diff --git a/packages/e2e-tests/test-registry.npmrc b/packages/e2e-tests/test-registry.npmrc index 9109d3a6935c..c35d987cca9f 100644 --- a/packages/e2e-tests/test-registry.npmrc +++ b/packages/e2e-tests/test-registry.npmrc @@ -1,2 +1,3 @@ -registry=http://localhost:4873/ +@sentry:registry=http://localhost:4873 +@sentry-internal:registry=http://localhost:4873 //localhost:4873/:_authToken=some-token From 8c3e5e67e4660dad3b16da18501a0a04b7ee8fc4 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 12:41:23 +0000 Subject: [PATCH 25/28] Update eslintrc --- packages/e2e-tests/.eslintrc.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/e2e-tests/.eslintrc.js b/packages/e2e-tests/.eslintrc.js index 7066f43bde55..5b0457483479 100644 --- a/packages/e2e-tests/.eslintrc.js +++ b/packages/e2e-tests/.eslintrc.js @@ -1,10 +1,9 @@ module.exports = { env: { - browser: true, node: true, }, extends: ['../../.eslintrc.js'], - ignorePatterns: ['suites/**/subject.js', 'suites/**/dist/*'], + ignorePatterns: [], parserOptions: { sourceType: 'module', }, From d648a036474e9fdfda2b8416e95c5c38d01dc28f Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 13:02:05 +0000 Subject: [PATCH 26/28] Improve log message in validation script --- .../e2e-tests/validate-verdaccio-configuration.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/e2e-tests/validate-verdaccio-configuration.ts b/packages/e2e-tests/validate-verdaccio-configuration.ts index b26b5fcf1f01..ca0b20f7213e 100644 --- a/packages/e2e-tests/validate-verdaccio-configuration.ts +++ b/packages/e2e-tests/validate-verdaccio-configuration.ts @@ -30,8 +30,16 @@ const sentryScopedPackageNames = packageJsons // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access .map(packageJson => packageJson.name); -const mergedSize = new Set([...sentryScopedPackagesInVerdaccioConfig, ...sentryScopedPackageNames]).size; +const extraPackagesInVerdaccioConfig = sentryScopedPackagesInVerdaccioConfig.filter( + x => !sentryScopedPackageNames.includes(x), +); +const extraPackagesInMonoRepo = sentryScopedPackageNames.filter( + x => !sentryScopedPackagesInVerdaccioConfig.includes(x), +); + assert.ok( - mergedSize === sentryScopedPackagesInVerdaccioConfig.length && mergedSize === sentryScopedPackageNames.length, - 'Packages in Verdaccio configuration do not match the "@sentry"-scoped packages in monorepo. Make sure they match!', + extraPackagesInVerdaccioConfig.length === 0 && extraPackagesInMonoRepo.length === 0, + `Packages in Verdaccio configuration do not match the "@sentry"-scoped packages in monorepo. Make sure they match!\nPackages missing in Verdaccio configuration: ${JSON.stringify( + extraPackagesInMonoRepo, + )}\nPackages missing in monorepo: ${JSON.stringify(extraPackagesInVerdaccioConfig)}`, ); From c5e4c20a532b8bee1ed3d0a984cc708ea18978e5 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 13:10:26 +0000 Subject: [PATCH 27/28] Remove -it flag from docker run --- packages/e2e-tests/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index 263a2f4d02dd..b5b6b49bdcee 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -38,7 +38,7 @@ childProcess.execSync( // Run container that uploads our packages to fake registry childProcess.execSync( - `docker run --sig-proxy=true -it --rm -v ${repositoryRoot}:/sentry-javascript --network host ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME}`, + `docker run --sig-proxy=true --rm -v ${repositoryRoot}:/sentry-javascript --network host ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME}`, { encoding: 'utf8', stdio: 'inherit', From dfe6809b3ffd4fcfe910c4e92f65fddbc2064a83 Mon Sep 17 00:00:00 2001 From: Luca Forstner Date: Mon, 26 Sep 2022 13:38:49 +0000 Subject: [PATCH 28/28] Remove --sig-proxy flag --- packages/e2e-tests/run.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/run.ts b/packages/e2e-tests/run.ts index b5b6b49bdcee..4a752e15a294 100644 --- a/packages/e2e-tests/run.ts +++ b/packages/e2e-tests/run.ts @@ -38,7 +38,7 @@ childProcess.execSync( // Run container that uploads our packages to fake registry childProcess.execSync( - `docker run --sig-proxy=true --rm -v ${repositoryRoot}:/sentry-javascript --network host ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME}`, + `docker run --rm -v ${repositoryRoot}:/sentry-javascript --network host ${PUBLISH_PACKAGES_DOCKER_IMAGE_NAME}`, { encoding: 'utf8', stdio: 'inherit',