diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 6db2a629..4ef66407 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -190,44 +190,6 @@ jobs: path: packages - run: yarn test:integration-next - test-e2e: - # We only run E2E tests for non-fork PRs because the E2E tests require secrets to work and they can't be accessed from forks - # Dependabot PRs sadly also don't have access to secrets, so we skip them as well - if: - (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && - github.actor != 'dependabot[bot]' && - false # Debug ID backend changes broke the E2E tests, we need to revisit them - needs: build - name: E2E Tests - runs-on: ubuntu-latest - env: - SENTRY_AUTH_TOKEN: ${{ secrets.E2E_TESTS_SENTRY_AUTH_TOKEN }} - steps: - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 - - uses: volta-cli/action@007b1509d3ea9999dbba62ca34f4eb968363bb78 # v3 - - name: Use dependency cache - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 - id: dependency-cache - with: - path: "**/node_modules" - key: ${{ runner.os }}-${{ hashFiles('**/package.json') }}-${{ hashFiles('**/yarn.lock') }} - - name: Use build cache - uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 - with: - path: .nxcache - key: build-cache-key-${{ runner.os }}-${{ matrix.target }}-${{ matrix.jobIndex }}-${{ github.run_id }} - restore-keys: | - build-cache-key-${{ runner.os }}-${{ matrix.target }}-${{ matrix.jobIndex }}- - - name: Install dependencies - run: yarn --frozen-lockfile --ignore-engines - if: steps.dependency-cache.outputs.cache-hit != 'true' - - name: Download build artifacts - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 - with: - name: dist-artifacts-${{ github.run_id }} - path: packages - - run: yarn test:e2e - lint: needs: build name: Linter check diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 9a803f10..ba18e1d9 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -3,9 +3,5 @@ "printWidth": 100, "experimentalSortPackageJson": false, "trailingComma": "es5", - "ignorePatterns": [ - "packages/e2e-tests/scenarios/*/ref/**/*", - "packages/bundler-plugin-core/test/fixtures", - ".nxcache" - ] + "ignorePatterns": ["packages/bundler-plugin-core/test/fixtures", ".nxcache"] } diff --git a/package.json b/package.json index 72295217..d1e957aa 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ "packages/babel-plugin-component-annotate", "packages/bundler-plugin-core", "packages/dev-utils", - "packages/e2e-tests", "packages/esbuild-plugin", "packages/eslint-configs", "packages/integration-tests", @@ -28,12 +27,10 @@ "check:types": "nx run-many --target=check:types --all", "clean": "nx run-many --target=clean --all", "clean:all": "nx run-many --target=clean:all --all && yarn", - "test": "nx run-many --target=test --all --exclude=@sentry-internal/bundler-plugin-e2e-tests", - "test:all": "nx run-many --target=test --all", - "test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next,@sentry-internal/bundler-plugin-e2e-tests", + "test": "nx run-many --target=test --all", + "test:unit": "nx run-many --target=test --all --exclude=@sentry-internal/integration-tests,@sentry-internal/integration-tests-next", "test:integration": "nx run @sentry-internal/integration-tests:test", "test:integration-next": "nx run @sentry-internal/integration-tests-next:test", - "test:e2e": "nx run @sentry-internal/bundler-plugin-e2e-tests:test", "lint": "nx run-many --target=lint --all", "check:formatting": "oxfmt --check .", "fix:formatting": "oxfmt ." diff --git a/packages/e2e-tests/.env.example b/packages/e2e-tests/.env.example deleted file mode 100644 index 98608208..00000000 --- a/packages/e2e-tests/.env.example +++ /dev/null @@ -1 +0,0 @@ -SENTRY_AUTH_TOKEN= \ No newline at end of file diff --git a/packages/e2e-tests/.eslintrc.js b/packages/e2e-tests/.eslintrc.js deleted file mode 100644 index c0340602..00000000 --- a/packages/e2e-tests/.eslintrc.js +++ /dev/null @@ -1,17 +0,0 @@ -/** @type {import('eslint').ESLint.Options} */ -module.exports = { - root: true, - extends: ["@sentry-internal/eslint-config/base"], - ignorePatterns: [".eslintrc.js", "scenarios/*/out", "scenarios/*/ref", "scenarios/*/input"], - parserOptions: { - tsconfigRootDir: __dirname, - project: ["./tsconfig.json"], - }, - env: { - node: true, - }, - rules: { - "no-console": "off", - "@typescript-eslint/explicit-function-return-type": "off", - }, -}; diff --git a/packages/e2e-tests/.gitignore b/packages/e2e-tests/.gitignore deleted file mode 100644 index bacbd86e..00000000 --- a/packages/e2e-tests/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -**/out -!scenarios/*/ref/** -.env \ No newline at end of file diff --git a/packages/e2e-tests/README.md b/packages/e2e-tests/README.md deleted file mode 100644 index de8a2e6e..00000000 --- a/packages/e2e-tests/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# End-To-End Tests - -Each folder in the `scenarios` folder represents one testing scenario. -When `yarn test` is run, first `setup.ts` in all scenarios is executed, afterwards we run `vitest run`, which will pick up all `*.test.ts` files. -Generally, the `*.test.ts` files can then use anything that is generated via `setup.ts`. - -## Snapshot Test Structure - -For snapshot tests where files uploaded to Sentry are cpompared with local reference files, it's recommended to stick to the following structure inside a scenario folder: - -- `input` contains the JS input files. These will be bundled by all bundlers defined in `utils/bundlers.ts`. -- `ref` contains the reference files. All files that are uploaded to Sentry for one release must be present in this folder, in the same structure as the uploaded filename contains (e.g. `~/index.js`). Because generated JS and source maps look entirely different per bundler, reference files must be specified separately for each bundler. -- `config.ts` contains the bundler plugin config that is used to - 1. Delete a release from Sentry with the given `release` property - 2. Bundle files from `input` and upload them to Sentry - 3. Download the files from Sentry with the for the given `release` property -- `setup.ts` is the starting point to create bundles for all bundlers specified in `utils/bundlers.ts`. Specify the name of your entry point file(s) in this file. -- `*.test.ts` specifies all tests which are executed by Vitest for this scenario. - -Note that the final release name used per scenario is `[config.release]-[bundler]`. Each scenario will create separate releases for each bundler to distinguish the files generated by the bundlers. diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json deleted file mode 100644 index d3428db4..00000000 --- a/packages/e2e-tests/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@sentry-internal/bundler-plugin-e2e-tests", - "version": "5.2.0", - "license": "MIT", - "private": true, - "scripts": { - "test": "run-s test:setup test:e2e", - "test:setup": "ts-node scripts/run-scenario-setups.ts", - "test:e2e": "vitest run", - "check:types": "tsc --project ./tsconfig.json --noEmit", - "clean": "run-s clean:build", - "clean:all": "run-p clean clean:deps", - "clean:build": "premove ./scenarios/*/out", - "clean:deps": "premove node_modules", - "lint": "eslint ." - }, - "dependencies": { - "@sentry/esbuild-plugin": "5.2.0", - "@sentry/rollup-plugin": "5.2.0", - "@sentry/vite-plugin": "5.2.0", - "@sentry/webpack-plugin": "5.2.0", - "axios": "1.13.5" - }, - "devDependencies": { - "@sentry-internal/eslint-config": "5.2.0", - "@sentry-internal/sentry-bundler-plugin-tsconfig": "5.2.0", - "@types/axios": "^0.14.0", - "@types/glob": "8.0.0", - "esbuild": "0.14.49", - "eslint": "^8.18.0", - "glob": "^13.0.6", - "vitest": "^4.0.0", - "premove": "^4.0.0", - "rollup": "3.2.0", - "ts-node": "^10.9.1", - "vite": "3.0.0", - "webpack": "5.76.0" - }, - "volta": { - "extends": "../../package.json" - } -} diff --git a/packages/e2e-tests/scenarios/basic-upload/__snapshots__/basic-upload.test.ts.snap b/packages/e2e-tests/scenarios/basic-upload/__snapshots__/basic-upload.test.ts.snap deleted file mode 100644 index 51eb0c89..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/__snapshots__/basic-upload.test.ts.snap +++ /dev/null @@ -1,92 +0,0 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`Simple Sourcemaps Upload (one string include + default options) > uploads the correct files using esbuild 1`] = ` -Array [ - Object { - "content": "\\"use strict\\";var i=typeof window<\\"u\\"?window:typeof global<\\"u\\"?global:typeof self<\\"u\\"?self:{};i.SENTRY_RELEASE={id:\\"basic-upload-esbuild\\"};var e=o=>{if(o===3)throw new Error(\\"I'm an uncaught error\\");return o<=1?o:e(o-1)+e(o-2)};console.log(\\"Hi, I'm a very simple app\\");e(10);console.log(\\"I'm done\\"); -//# sourceMappingURL=index.js.map -", - "name": "~/index.js", - }, - Object { - "content": "{\\"version\\":3,\\"sources\\":[\\"../../../../../bundler-plugin-core/sentry-release-injection-file.js\\",\\"../../input/fib.js\\",\\"../../input/index.js\\"],\\"sourcesContent\\":[\\"// This const is used for nothing except to make this file identifiable via its content.\\\\n// We search for \\\\\\"_sentry_release_injection_file\\\\\\" in the plugin to determine for sure that the file we look at is the release injection file.\\\\n\\\\n// _sentry_release_injection_file\\\\n\\\\n var _global =\\\\n typeof window !== 'undefined' ?\\\\n window :\\\\n typeof global !== 'undefined' ?\\\\n global :\\\\n typeof self !== 'undefined' ?\\\\n self :\\\\n {};\\\\n\\\\n _global.SENTRY_RELEASE={id:\\\\\\"basic-upload-esbuild\\\\\\"};\\",\\"export const fibonacci = (n) => {\\\\n if (n === 3) {\\\\n throw new Error(\\\\\\"I'm an uncaught error\\\\\\");\\\\n }\\\\n if (n <= 1) {\\\\n return n;\\\\n }\\\\n return fibonacci(n - 1) + fibonacci(n - 2);\\\\n};\\\\n;\\\\nimport \\\\\\"/home/runner/work/sentry-javascript-bundler-plugins/sentry-javascript-bundler-plugins/packages/bundler-plugin-core/sentry-release-injection-file.js\\\\\\";\\",\\"import { fibonacci } from \\\\\\"./fib\\\\\\";\\\\nconsole.log(\\\\\\"Hi, I'm a very simple app\\\\\\");\\\\n\\\\nfibonacci(10);\\\\n\\\\nconsole.log(\\\\\\"I'm done\\\\\\");\\\\n;\\\\nimport \\\\\\"/home/runner/work/sentry-javascript-bundler-plugins/sentry-javascript-bundler-plugins/packages/bundler-plugin-core/sentry-release-injection-file.js\\\\\\";\\"],\\"names\\":[],\\"mappings\\":\\"aAKI,GAAI,GACF,MAAO,QAAW,IAChB,OACA,MAAO,QAAW,IAChB,OACA,MAAO,MAAS,IACd,KACA,CAAC,EAET,EAAQ,eAAe,CAAC,GAAG,sBAAsB,ECd9C,GAAM,GAAY,AAAC,GAAM,CAC9B,GAAI,IAAM,EACR,KAAM,IAAI,OAAM,uBAAuB,EAEzC,MAAI,IAAK,EACA,EAEF,EAAU,EAAI,CAAC,EAAI,EAAU,EAAI,CAAC,CAC3C,ECPA,QAAQ,IAAI,2BAA2B,EAEvC,EAAU,EAAE,EAEZ,QAAQ,IAAI,UAAU\\"}", - "name": "~/index.js.map", - }, -] -`; - -exports[`Simple Sourcemaps Upload (one string include + default options) > uploads the correct files using rollup 1`] = ` -Array [ - Object { - "content": "'use strict'; - -// This const is used for nothing except to make this file identifiable via its content. -// We search for \\"_sentry_release_injection_file\\" in the plugin to determine for sure that the file we look at is the release injection file. - -// _sentry_release_injection_file - - var _global = - typeof window !== 'undefined' ? - window : - typeof global !== 'undefined' ? - global : - typeof self !== 'undefined' ? - self : - {}; - - _global.SENTRY_RELEASE={id:\\"basic-upload-rollup\\"}; - -const fibonacci = (n) => { - if (n === 3) { - throw new Error(\\"I'm an uncaught error\\"); - } - if (n <= 1) { - return n; - } - return fibonacci(n - 1) + fibonacci(n - 2); -}; - -console.log(\\"Hi, I'm a very simple app\\"); - -fibonacci(10); - -console.log(\\"I'm done\\"); -//# sourceMappingURL=index.js.map -", - "name": "~/index.js", - }, - Object { - "content": "{\\"version\\":3,\\"file\\":\\"index.js\\",\\"sources\\":[\\"../../../../../bundler-plugin-core/sentry-release-injection-file.js\\",\\"../../input/fib.js\\",\\"../../input/index.js\\"],\\"sourcesContent\\":[\\"// This const is used for nothing except to make this file identifiable via its content.\\\\n// We search for \\\\\\"_sentry_release_injection_file\\\\\\" in the plugin to determine for sure that the file we look at is the release injection file.\\\\n\\\\n// _sentry_release_injection_file\\\\n\\",\\"export const fibonacci = (n) => {\\\\n if (n === 3) {\\\\n throw new Error(\\\\\\"I'm an uncaught error\\\\\\");\\\\n }\\\\n if (n <= 1) {\\\\n return n;\\\\n }\\\\n return fibonacci(n - 1) + fibonacci(n - 2);\\\\n};\\\\n\\",\\"import { fibonacci } from \\\\\\"./fib\\\\\\";\\\\nconsole.log(\\\\\\"Hi, I'm a very simple app\\\\\\");\\\\n\\\\nfibonacci(10);\\\\n\\\\nconsole.log(\\\\\\"I'm done\\\\\\");\\\\n\\"],\\"names\\":[],\\"mappings\\":\\";;AAAA;AACA;AACA;AACA;;;;;;;;;;;;;ACHA,MAAA,SAAA,GAAA,CAAA,CAAA,KAAA;AACA,EAAA,IAAA,CAAA,KAAA,CAAA,EAAA;AACA,IAAA,MAAA,IAAA,KAAA,CAAA,uBAAA,CAAA,CAAA;AACA,GAAA;AACA,EAAA,IAAA,CAAA,IAAA,CAAA,EAAA;AACA,IAAA,OAAA,CAAA,CAAA;AACA,GAAA;AACA,EAAA,OAAA,SAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,SAAA,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA;AACA,CAAA;;ACPA,OAAA,CAAA,GAAA,CAAA,2BAAA,CAAA,CAAA;AACA;AACA,SAAA,CAAA,EAAA,CAAA,CAAA;AACA;AACA,OAAA,CAAA,GAAA,CAAA,UAAA,CAAA\\"}", - "name": "~/index.js.map", - }, -] -`; - -exports[`Simple Sourcemaps Upload (one string include + default options) > uploads the correct files using vite 1`] = ` -Array [ - Object { - "content": "\\"use strict\\";var i=typeof window<\\"u\\"?window:typeof global<\\"u\\"?global:typeof self<\\"u\\"?self:{};i.SENTRY_RELEASE={id:\\"basic-upload-vite\\"};const o=e=>{if(e===3)throw new Error(\\"I'm an uncaught error\\");return e<=1?e:o(e-1)+o(e-2)};console.log(\\"Hi, I'm a very simple app\\");o(10);console.log(\\"I'm done\\"); -//# sourceMappingURL=index.js.map -", - "name": "~/index.js", - }, - Object { - "content": "{\\"version\\":3,\\"file\\":\\"index.js\\",\\"sources\\":[\\"../../input/fib.js\\",\\"../../input/index.js\\"],\\"sourcesContent\\":[\\"export const fibonacci = (n) => {\\\\n if (n === 3) {\\\\n throw new Error(\\\\\\"I'm an uncaught error\\\\\\");\\\\n }\\\\n if (n <= 1) {\\\\n return n;\\\\n }\\\\n return fibonacci(n - 1) + fibonacci(n - 2);\\\\n};\\\\n\\",\\"import { fibonacci } from \\\\\\"./fib\\\\\\";\\\\nconsole.log(\\\\\\"Hi, I'm a very simple app\\\\\\");\\\\n\\\\nfibonacci(10);\\\\n\\\\nconsole.log(\\\\\\"I'm done\\\\\\");\\\\n\\"],\\"names\\":[\\"fibonacci\\",\\"n\\"],\\"mappings\\":\\"uIAAA,MAAAA,EAAAC,GAAA,CACA,GAAAA,IAAA,EACA,MAAA,IAAA,MAAA,uBAAA,EAEA,OAAAA,GAAA,EACAA,EAEAD,EAAAC,EAAA,CAAA,EAAAD,EAAAC,EAAA,CAAA,CACA,ECPA,QAAA,IAAA,2BAAA,EAEAD,EAAA,EAAA,EAEA,QAAA,IAAA,UAAA\\"}", - "name": "~/index.js.map", - }, -] -`; - -exports[`Simple Sourcemaps Upload (one string include + default options) > uploads the correct files using webpack 1`] = ` -Array [ - Object { - "content": "(()=>{var e={677:(e,o,r)=>{(\\"undefined\\"!=typeof window?window:void 0!==r.g?r.g:\\"undefined\\"!=typeof self?self:{}).SENTRY_RELEASE={id:\\"basic-upload-webpack\\"}}},o={};function r(t){var n=o[t];if(void 0!==n)return n.exports;var i=o[t]={exports:{}};return e[t](i,i.exports,r),i.exports}r.g=function(){if(\\"object\\"==typeof globalThis)return globalThis;try{return this||new Function(\\"return this\\")()}catch(e){if(\\"object\\"==typeof window)return window}}(),r.r=e=>{\\"undefined\\"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:\\"Module\\"}),Object.defineProperty(e,\\"__esModule\\",{value:!0})};var t={};(()=>{\\"use strict\\";r.r(t),r(677);const e=o=>{if(3===o)throw new Error(\\"I'm an uncaught error\\");return o<=1?o:e(o-1)+e(o-2)};console.log(\\"Hi, I'm a very simple app\\"),e(10),console.log(\\"I'm done\\")})();var n=exports;for(var i in t)n[i]=t[i];t.__esModule&&Object.defineProperty(n,\\"__esModule\\",{value:!0})})(); -//# sourceMappingURL=index.js.map", - "name": "~/index.js", - }, - Object { - "content": "{\\"version\\":3,\\"file\\":\\"index.js\\",\\"sources\\":[\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/../bundler-plugin-core/sentry-release-injection-file.js\\",\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/webpack/bootstrap\\",\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/webpack/runtime/global\\",\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/webpack/runtime/make namespace object\\",\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/./scenarios/basic-upload/input/fib.js\\",\\"webpack://@sentry-internal/bundler-plugin-e2e-tests/./scenarios/basic-upload/input/index.js\\"],\\"sourcesContent\\":[\\"// This const is used for nothing except to make this file identifiable via its content.\\\\n// We search for \\\\\\"_sentry_release_injection_file\\\\\\" in the plugin to determine for sure that the file we look at is the release injection file.\\\\n\\\\n// _sentry_release_injection_file\\\\n\\\\n var _global =\\\\n typeof window !== 'undefined' ?\\\\n window :\\\\n typeof global !== 'undefined' ?\\\\n global :\\\\n typeof self !== 'undefined' ?\\\\n self :\\\\n {};\\\\n\\\\n _global.SENTRY_RELEASE={id:\\\\\\"basic-upload-webpack\\\\\\"};\\",\\"// The module cache\\\\nvar __webpack_module_cache__ = {};\\\\n\\\\n// The require function\\\\nfunction __webpack_require__(moduleId) {\\\\n\\\\t// Check if module is in cache\\\\n\\\\tvar cachedModule = __webpack_module_cache__[moduleId];\\\\n\\\\tif (cachedModule !== undefined) {\\\\n\\\\t\\\\treturn cachedModule.exports;\\\\n\\\\t}\\\\n\\\\t// Create a new module (and put it into the cache)\\\\n\\\\tvar module = __webpack_module_cache__[moduleId] = {\\\\n\\\\t\\\\t// no module.id needed\\\\n\\\\t\\\\t// no module.loaded needed\\\\n\\\\t\\\\texports: {}\\\\n\\\\t};\\\\n\\\\n\\\\t// Execute the module function\\\\n\\\\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\\\\n\\\\n\\\\t// Return the exports of the module\\\\n\\\\treturn module.exports;\\\\n}\\\\n\\\\n\\",\\"__webpack_require__.g = (function() {\\\\n\\\\tif (typeof globalThis === 'object') return globalThis;\\\\n\\\\ttry {\\\\n\\\\t\\\\treturn this || new Function('return this')();\\\\n\\\\t} catch (e) {\\\\n\\\\t\\\\tif (typeof window === 'object') return window;\\\\n\\\\t}\\\\n})();\\",\\"// define __esModule on exports\\\\n__webpack_require__.r = (exports) => {\\\\n\\\\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\\\\n\\\\t\\\\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\\\\n\\\\t}\\\\n\\\\tObject.defineProperty(exports, '__esModule', { value: true });\\\\n};\\",\\"export const fibonacci = (n) => {\\\\n if (n === 3) {\\\\n throw new Error(\\\\\\"I'm an uncaught error\\\\\\");\\\\n }\\\\n if (n <= 1) {\\\\n return n;\\\\n }\\\\n return fibonacci(n - 1) + fibonacci(n - 2);\\\\n};\\\\n;\\\\nimport \\\\\\"/home/runner/work/sentry-javascript-bundler-plugins/sentry-javascript-bundler-plugins/packages/bundler-plugin-core/sentry-release-injection-file.js\\\\\\";\\",\\"import { fibonacci } from \\\\\\"./fib\\\\\\";\\\\nconsole.log(\\\\\\"Hi, I'm a very simple app\\\\\\");\\\\n\\\\nfibonacci(10);\\\\n\\\\nconsole.log(\\\\\\"I'm done\\\\\\");\\\\n;\\\\nimport \\\\\\"/home/runner/work/sentry-javascript-bundler-plugins/sentry-javascript-bundler-plugins/packages/bundler-plugin-core/sentry-release-injection-file.js\\\\\\";\\"],\\"names\\":[\\"window\\",\\"g\\",\\"self\\",\\"SENTRY_RELEASE\\",\\"id\\",\\"__webpack_module_cache__\\",\\"__webpack_require__\\",\\"moduleId\\",\\"cachedModule\\",\\"undefined\\",\\"exports\\",\\"module\\",\\"__webpack_modules__\\",\\"globalThis\\",\\"this\\",\\"Function\\",\\"e\\",\\"r\\",\\"Symbol\\",\\"toStringTag\\",\\"Object\\",\\"defineProperty\\",\\"value\\",\\"fibonacci\\",\\"n\\",\\"Error\\",\\"console\\",\\"log\\"],\\"mappings\\":\\"4BAMwB,oBAAXA,OACLA,YACkB,IAAX,EAAAC,EACL,EAAAA,EACgB,oBAATC,KACLA,KACA,CAAC,GAEDC,eAAe,CAACC,GAAG,wB,GCb3BC,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaE,QAGrB,IAAIC,EAASN,EAAyBE,GAAY,CAGjDG,QAAS,CAAC,GAOX,OAHAE,EAAoBL,GAAUI,EAAQA,EAAOD,QAASJ,GAG/CK,EAAOD,OACf,CCtBAJ,EAAoBL,EAAI,WACvB,GAA0B,iBAAfY,WAAyB,OAAOA,WAC3C,IACC,OAAOC,MAAQ,IAAIC,SAAS,cAAb,EAGhB,CAFE,MAAOC,GACR,GAAsB,iBAAXhB,OAAqB,OAAOA,MACxC,CACA,CAPuB,GCCxBM,EAAoBW,EAAKP,IACH,oBAAXQ,QAA0BA,OAAOC,aAC1CC,OAAOC,eAAeX,EAASQ,OAAOC,YAAa,CAAEG,MAAO,WAE7DF,OAAOC,eAAeX,EAAS,aAAc,CAAEY,OAAO,GAAO,E,0CCLvD,MAAMC,EAAaC,IACxB,GAAU,IAANA,EACF,MAAM,IAAIC,MAAM,yBAElB,OAAID,GAAK,EACAA,EAEFD,EAAUC,EAAI,GAAKD,EAAUC,EAAI,EAAE,ECN5CE,QAAQC,IAAI,6BAEZJ,EAAU,IAEVG,QAAQC,IAAI,W\\"}", - "name": "~/index.js.map", - }, -] -`; diff --git a/packages/e2e-tests/scenarios/basic-upload/basic-upload.test.ts b/packages/e2e-tests/scenarios/basic-upload/basic-upload.test.ts deleted file mode 100644 index 3626dc73..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/basic-upload.test.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { pluginConfig } from "./config"; -import { BUNDLERS } from "../../utils/bundlers"; -import { getSentryReleaseFiles } from "../../utils/releases"; -import { describe, expect, it } from "vitest"; - -describe("Simple Sourcemaps Upload (one string include + default options)", () => { - it.each(BUNDLERS)("uploads the correct files using %s", async (bundler) => { - const release = `${pluginConfig.release?.name || ""}-${bundler}`; - - const sentryFiles = await getSentryReleaseFiles(release); - - expect(sentryFiles).toMatchSnapshot(); - }); -}); diff --git a/packages/e2e-tests/scenarios/basic-upload/config.ts b/packages/e2e-tests/scenarios/basic-upload/config.ts deleted file mode 100644 index c869c8d0..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Options } from "@sentry/bundler-plugin-core"; -import * as path from "path"; - -/** - * The Sentry bundler plugin config object used for this test - */ -export const pluginConfig: Options = { - release: { - name: "basic-upload", - uploadLegacySourcemaps: path.resolve(__dirname, "out"), - }, - authToken: process.env["SENTRY_AUTH_TOKEN"] || "", - org: "sentry-sdks", - project: "js-bundler-plugin-e2e-tests", -}; diff --git a/packages/e2e-tests/scenarios/basic-upload/input/fib.js b/packages/e2e-tests/scenarios/basic-upload/input/fib.js deleted file mode 100644 index a6da581e..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/input/fib.js +++ /dev/null @@ -1,9 +0,0 @@ -export const fibonacci = (n) => { - if (n === 3) { - throw new Error("I'm an uncaught error"); - } - if (n <= 1) { - return n; - } - return fibonacci(n - 1) + fibonacci(n - 2); -}; diff --git a/packages/e2e-tests/scenarios/basic-upload/input/index.js b/packages/e2e-tests/scenarios/basic-upload/input/index.js deleted file mode 100644 index 8159534a..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/input/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import { fibonacci } from "./fib"; -console.log("Hi, I'm a very simple app"); - -fibonacci(10); - -console.log("I'm done"); diff --git a/packages/e2e-tests/scenarios/basic-upload/setup.ts b/packages/e2e-tests/scenarios/basic-upload/setup.ts deleted file mode 100644 index f6c4a4f4..00000000 --- a/packages/e2e-tests/scenarios/basic-upload/setup.ts +++ /dev/null @@ -1,16 +0,0 @@ -import * as path from "path"; - -import { pluginConfig } from "./config"; -import { deleteAllReleases } from "../../utils/releases"; -import { createCjsBundles } from "../../utils/create-cjs-bundles"; - -deleteAllReleases(pluginConfig.release?.name || "") - .then(() => { - const entryPointPath = path.resolve(__dirname, "input", "index.js"); - const outputDir = path.resolve(__dirname, "out"); - - createCjsBundles({ index: entryPointPath }, outputDir, pluginConfig); - }) - .catch(() => { - console.error("Could not delete release!"); - }); diff --git a/packages/e2e-tests/scripts/run-scenario-setups.ts b/packages/e2e-tests/scripts/run-scenario-setups.ts deleted file mode 100644 index 2d55a4b2..00000000 --- a/packages/e2e-tests/scripts/run-scenario-setups.ts +++ /dev/null @@ -1,10 +0,0 @@ -import fs from "fs"; -import path from "path"; - -const scenarioPaths = fs - .readdirSync(path.join(__dirname, "..", "scenarios")) - .map((fixtureDir) => path.join(__dirname, "..", "scenarios", fixtureDir)); - -scenarioPaths.forEach((fixturePath) => { - require(path.join(fixturePath, "setup.ts")); -}); diff --git a/packages/e2e-tests/tsconfig.json b/packages/e2e-tests/tsconfig.json deleted file mode 100644 index b472a552..00000000 --- a/packages/e2e-tests/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/tsconfig", - "extends": "@sentry-internal/sentry-bundler-plugin-tsconfig/base-config.json", - "include": ["./**/*"], - "compilerOptions": { - "esModuleInterop": true, - "types": ["node"] - } -} diff --git a/packages/e2e-tests/utils/bundlers.ts b/packages/e2e-tests/utils/bundlers.ts deleted file mode 100644 index 32cea789..00000000 --- a/packages/e2e-tests/utils/bundlers.ts +++ /dev/null @@ -1 +0,0 @@ -export const BUNDLERS = ["rollup", "vite", "esbuild", "webpack"]; diff --git a/packages/e2e-tests/utils/create-cjs-bundles.ts b/packages/e2e-tests/utils/create-cjs-bundles.ts deleted file mode 100644 index 931a8862..00000000 --- a/packages/e2e-tests/utils/create-cjs-bundles.ts +++ /dev/null @@ -1,123 +0,0 @@ -import * as vite from "vite"; -import * as path from "path"; -import * as rollup from "rollup"; -import { webpack } from "webpack"; -import * as esbuild from "esbuild"; - -import type { Options } from "@sentry/bundler-plugin-core"; -import { sentryVitePlugin } from "@sentry/vite-plugin"; -import { sentryWebpackPlugin } from "@sentry/webpack-plugin"; -import { sentryEsbuildPlugin } from "@sentry/esbuild-plugin"; -import { sentryRollupPlugin } from "@sentry/rollup-plugin"; - -export function createCjsBundles( - entrypoints: { [name: string]: string }, - outFolder: string, - sentryPluginOptions: Options -): void { - if (!sentryPluginOptions.release) { - console.error("Config has no release set, aborting"); - return; - } - - void vite.build({ - clearScreen: false, - build: { - sourcemap: true, - outDir: path.join(outFolder, "vite"), - rollupOptions: { - input: entrypoints, - output: { - format: "cjs", - entryFileNames: "[name].js", - }, - }, - }, - plugins: [ - sentryVitePlugin({ - ...sentryPluginOptions, - release: { - name: `${sentryPluginOptions.release.name!}-vite`, - uploadLegacySourcemaps: `${ - sentryPluginOptions.release.uploadLegacySourcemaps as string - }/vite`, - }, - }) as unknown as vite.Plugin, - ], - }); - - void rollup - .rollup({ - input: entrypoints, - plugins: [ - sentryRollupPlugin({ - ...sentryPluginOptions, - release: { - name: `${sentryPluginOptions.release.name!}-rollup`, - uploadLegacySourcemaps: `${ - sentryPluginOptions.release.uploadLegacySourcemaps as string - }/rollup`, - }, - }), - ], - }) - .then((bundle) => - bundle.write({ - sourcemap: true, - dir: path.join(outFolder, "rollup"), - format: "cjs", - exports: "named", - }) - ); - - void esbuild.build({ - entryPoints: entrypoints, - outdir: path.join(outFolder, "esbuild"), - sourcemap: true, - plugins: [ - sentryEsbuildPlugin({ - ...sentryPluginOptions, - release: { - name: `${sentryPluginOptions.release.name!}-esbuild`, - uploadLegacySourcemaps: `${ - sentryPluginOptions.release.uploadLegacySourcemaps as string - }/esbuild`, - }, - }), - ], - minify: true, - bundle: true, - format: "cjs", - }); - - webpack( - { - devtool: "source-map", - cache: false, - entry: entrypoints, - output: { - path: path.join(outFolder, "webpack"), - library: { - type: "commonjs", - }, - }, - mode: "production", - plugins: [ - sentryWebpackPlugin({ - ...sentryPluginOptions, - release: { - name: `${sentryPluginOptions.release.name!}-webpack`, - uploadLegacySourcemaps: `${ - sentryPluginOptions.release.uploadLegacySourcemaps as string - }/webpack`, - }, - }), - ], - }, - (err) => { - if (err) { - throw err; - } - } - ); -} diff --git a/packages/e2e-tests/utils/releases.ts b/packages/e2e-tests/utils/releases.ts deleted file mode 100644 index 9f8740a4..00000000 --- a/packages/e2e-tests/utils/releases.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { AxiosError } from "axios"; -import { BUNDLERS } from "./bundlers"; -import { - deleteReleaseFromSentry, - getReleaseFileFromSentry, - getReleaseFilesFromSentry, -} from "./sentry-api"; - -type ReleaseFilesData = { - id: string; - name: string; - dist?: string; - headers: Record; - size: number; - sha1: string; - dateCreated: string; -}; - -type ReleaseFile = { - name: string; - content: string; -}; - -export function deleteAllReleases(release: string) { - return Promise.all( - BUNDLERS.map(async (bundler) => { - const bundlerRelease = `${release}-${bundler}`; - try { - const response = await deleteReleaseFromSentry(bundlerRelease); - return response; - } catch (e) { - if ((e as AxiosError).response?.status === 404) { - return Promise.resolve(); - } - throw e; - } - }) - ); -} - -export async function getSentryReleaseFiles(release: string): Promise { - const releaseFileEntries = await getReleaseFiles(release); - - const releaseFiles: ReleaseFile[] = await Promise.all( - releaseFileEntries.map((entry) => getReleaseFile(release, entry)) - ); - return releaseFiles; -} - -async function getReleaseFiles(release: string): Promise { - const response = await getReleaseFilesFromSentry(release); - return response.data as ReleaseFilesData[]; -} - -async function getReleaseFile(release: string, fileEntry: ReleaseFilesData): Promise { - const response = await getReleaseFileFromSentry(release, fileEntry.id); - const data = response.data as ReleaseFile; - - return { - name: fileEntry.name, - // source maps are JSON and therefore, axios returns them as an object - // We want them as a string, though, so we convert it - content: typeof data === "object" ? JSON.stringify(data) : data, - }; -} diff --git a/packages/e2e-tests/utils/sentry-api.ts b/packages/e2e-tests/utils/sentry-api.ts deleted file mode 100644 index c275b0fa..00000000 --- a/packages/e2e-tests/utils/sentry-api.ts +++ /dev/null @@ -1,39 +0,0 @@ -import axios from "axios"; - -const AUTH_TOKEN = process.env["SENTRY_AUTH_TOKEN"] || ""; -const SENTRY_TEST_ORG_SLUG = "sentry-sdks"; -const SENTRY_TEST_PROJECT = "js-bundler-plugin-e2e-tests"; - -/** - * Sends a request to the Sentry API to GET all release files of a given release name - */ -export async function getReleaseFilesFromSentry(release: string) { - return axios.get( - `https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/releases/${release}/files/`, - { headers: getSentryApiHeaders() } - ); -} - -/** - * Sends a request to the Sentry API to GET a specific release file of a given release name and fileId - */ -export async function getReleaseFileFromSentry(release: string, fileId: string) { - return axios.get( - `https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/releases/${release}/files/${fileId}/?download=1`, - { headers: getSentryApiHeaders() } - ); -} - -/** - * Sends a request to the Sentry API to DELETE a specific release for a given release name - */ -export async function deleteReleaseFromSentry(release: string) { - return axios.delete( - `https://sentry.io/api/0/projects/${SENTRY_TEST_ORG_SLUG}/${SENTRY_TEST_PROJECT}/releases/${release}/`, - { headers: getSentryApiHeaders() } - ); -} - -function getSentryApiHeaders() { - return { Authorization: `Bearer ${AUTH_TOKEN}` }; -} diff --git a/yarn.lock b/yarn.lock index a0758465..0668ea68 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1432,13 +1432,6 @@ dependencies: tslib "^2.4.0" -"@types/axios@^0.14.0": - version "0.14.0" - resolved "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz#ec2300fbe7d7dddd7eb9d3abf87999964cafce46" - integrity sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ== - dependencies: - axios "*" - "@types/babel__core@^7.20.5": version "7.20.5" resolved "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz#3df15f27ba85319caa07ba08d0721889bb39c017" @@ -1551,14 +1544,6 @@ "@types/qs" "*" "@types/serve-static" "*" -"@types/glob@8.0.0": - version "8.0.0" - resolved "https://registry.npmjs.org/@types/glob/-/glob-8.0.0.tgz#321607e9cbaec54f687a0792b2d1d370739455d2" - integrity sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA== - dependencies: - "@types/minimatch" "*" - "@types/node" "*" - "@types/http-proxy@^1.17.9": version "1.17.11" resolved "https://registry.npmjs.org/@types/http-proxy/-/http-proxy-1.17.11.tgz#0ca21949a5588d55ac2b659b69035c84bd5da293" @@ -1581,13 +1566,6 @@ resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz#93e25bf9ee75fe0fd80b594bc4feb0e862111b5a" integrity sha512-YATxVxgRqNH6nHEIsvg6k2Boc1JHI9ZbH5iWFFv/MTkchz3b1ieGDa5T0a9RznNdI0KhVbdbWSN+KWWrQZRxTw== -"@types/minimatch@*": - version "6.0.0" - resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-6.0.0.tgz#4d207b1cc941367bdcd195a3a781a7e4fc3b1e03" - integrity sha512-zmPitbQ8+6zNutpwgcQuLcsEpn/Cj54Kbn7L5pX0Os5kdWplB7xPgEh/g+SWOB/qmows2gpuCaPyduq8ZZRnxA== - dependencies: - minimatch "*" - "@types/node@*": version "22.19.11" resolved "https://registry.npmjs.org/@types/node/-/node-22.19.11.tgz#7e1feaad24e4e36c52fa5558d5864bb4b272603e" @@ -2173,23 +2151,14 @@ available-typed-arrays@^1.0.5: resolved "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -axios@*: - version "1.4.0" - resolved "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz#38a7bf1224cd308de271146038b551d725f0be1f" - integrity sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA== - dependencies: - follow-redirects "^1.15.0" - form-data "^4.0.0" - proxy-from-env "^1.1.0" - -axios@1.13.5, axios@^1.12.0: - version "1.13.5" - resolved "https://registry.npmjs.org/axios/-/axios-1.13.5.tgz#5e464688fa127e11a660a2c49441c009f6567a43" - integrity sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q== +axios@^1.12.0: + version "1.15.0" + resolved "https://registry.npmjs.org/axios/-/axios-1.15.0.tgz#0fcee91ef03d386514474904b27863b2c683bf4f" + integrity sha512-wWyJDlAatxk30ZJer+GeCWS209sA42X+N5jU2jy6oHTp7ufw8uzUTVFBX9+wTfAlhiJXGS0Bq7X6efruWjuK9Q== dependencies: follow-redirects "^1.15.11" form-data "^4.0.5" - proxy-from-env "^1.1.0" + proxy-from-env "^2.1.0" babel-loader@^8.0.0: version "8.3.0" @@ -3478,7 +3447,7 @@ flatted@^3.1.0: resolved "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787" integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ== -follow-redirects@^1.0.0, follow-redirects@^1.15.0: +follow-redirects@^1.0.0: version "1.15.2" resolved "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA== @@ -3495,15 +3464,6 @@ for-each@^0.3.3: dependencies: is-callable "^1.1.3" -form-data@^4.0.0: - version "4.0.0" - resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" - integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.5: version "4.0.5" resolved "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz#b49e48858045ff4cbf6b03e1805cebcad3679053" @@ -4368,13 +4328,6 @@ mimic-fn@^2.1.0: resolved "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@*, minimatch@^10.2.2: - version "10.2.2" - resolved "https://registry.npmjs.org/minimatch/-/minimatch-10.2.2.tgz#361603ee323cfb83496fea2ae17cc44ea4e1f99f" - integrity sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw== - dependencies: - brace-expansion "^5.0.2" - minimatch@10.1.1: version "10.1.1" resolved "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz#e6e61b9b0c1dcab116b5a7d1458e8b6ae9e73a55" @@ -4382,6 +4335,13 @@ minimatch@10.1.1: dependencies: "@isaacs/brace-expansion" "^5.0.0" +minimatch@^10.2.2: + version "10.2.2" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-10.2.2.tgz#361603ee323cfb83496fea2ae17cc44ea4e1f99f" + integrity sha512-+G4CpNBxa5MprY+04MbgOw1v7So6n5JY166pFi9KfYwT78fxScCeSNQSNzp6dpPSW2rONOps6Ocam1wFhCgoVw== + dependencies: + brace-expansion "^5.0.2" + minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.3" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.3.tgz#6a5cba9b31f503887018f579c89f81f61162e624" @@ -4925,6 +4885,11 @@ proxy-from-env@^1.1.0: resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== +proxy-from-env@^2.1.0: + version "2.1.0" + resolved "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-2.1.0.tgz#a7487568adad577cfaaa7e88c49cab3ab3081aba" + integrity sha512-cJ+oHTW1VAEa8cJslgmUZrc+sjRKgAKl3Zyse6+PV38hZe/V6Z14TbCuXcan9F9ghlz4QrFr2c92TNF82UkYHA== + punycode@^2.1.0: version "2.3.0" resolved "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz#f67fa67c94da8f4d0cfff981aee4118064199b8f"