From 0da9b28978de969f658a0f7a002ae9b83c28a8f7 Mon Sep 17 00:00:00 2001 From: jolo-dev Date: Sat, 28 Oct 2023 08:01:26 +0000 Subject: [PATCH] Adjust test --- .eslintignore | 1 + .eslintrc.cjs | 10 + .eslintrc.json | 8 - .gitignore | 1 - package.json | 14 +- pnpm-lock.yaml | 323 ++++++++++++++++++--- tests/integration/s3-simpler.integ.test.ts | 2 +- test.jpg => tests/test.jpg | Bin tests/unit/createMultipartUploads.test.ts | 2 +- tests/unit/generatePresignedUrl.test.ts | 8 +- tests/unit/uploadMultipart.test.ts | 2 +- tests/unit/uploadToS3.test.ts | 14 +- tests/vitest.config.integ.ts | 8 + tests/vitest.config.ts | 11 + tsconfig.json | 5 +- 15 files changed, 336 insertions(+), 73 deletions(-) create mode 100644 .eslintignore create mode 100644 .eslintrc.cjs delete mode 100644 .eslintrc.json rename test.jpg => tests/test.jpg (100%) create mode 100644 tests/vitest.config.integ.ts create mode 100644 tests/vitest.config.ts diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..ed9f9cc --- /dev/null +++ b/.eslintignore @@ -0,0 +1 @@ +coverage \ No newline at end of file diff --git a/.eslintrc.cjs b/.eslintrc.cjs new file mode 100644 index 0000000..d8f956f --- /dev/null +++ b/.eslintrc.cjs @@ -0,0 +1,10 @@ +module.exports = { + plugins: [ + '@typescript-eslint', + '@stylistic/ts' + ], + parser: '@typescript-eslint/parser', + rules: { + '@stylistic/ts/indent': ['error', 2] + }, +} \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index 41bcd26..0000000 --- a/.eslintrc.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "plugins": [ - "'@typescript-eslint", - "@stylistic/ts" - ], - "parser": "@typescript-eslint/parser", - "@stylistic/ts/indent": ["error", 2] -} \ No newline at end of file diff --git a/.gitignore b/.gitignore index cbef7d8..0cdccd2 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,6 @@ coverage/ !/.projenrc.js /test-reports/ junit.xml -!/./jest.config.json /coverage/ !/.github/workflows/build.yml /dist/changelog.md diff --git a/package.json b/package.json index 73c21d4..cfc515c 100644 --- a/package.json +++ b/package.json @@ -5,11 +5,13 @@ "type": "module", "scripts": { "build": "bun", - "lint": "eslint .", + "lint": "eslint --fix tests/**/*.ts", "test": "vitest", "test:watch": "vitest --watch", - "test:unit": "vitest -t tests/unit", - "test:integration": "vitest -t tests/integration" + "test:unit": "vitest --config ./tests/vitest.config.ts", + "test:integration": "vitest --config ./tests/vitest.config.integ.ts", + "test:coverage": "vitest run --coverage", + "test:ui": "vitest --ui" }, "engines": { "node": ">= 18" @@ -24,11 +26,15 @@ "@stylistic/eslint-plugin-ts": "^0.1.1", "@tsconfig/bun": "^1.0.1", "@types/node": "^20.8.9", + "@typescript-eslint/eslint-plugin": "^6.9.0", + "@typescript-eslint/parser": "^6.9.0", + "@vitest/coverage-v8": "^0.34.6", + "@vitest/ui": "^0.34.6", "aws-sdk-client-mock": "^3.0.0", "bun": "^1.0.7", "standard-version": "^9.5.0", "typescript": "^5.2.2", - "vitest": "^0.34.6" + "vitest": "^v1.0.0-beta.3" }, "dependencies": { "@aws-sdk/client-s3": "^3.437.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 57928f6..c99faa5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,18 @@ devDependencies: '@types/node': specifier: ^20.8.9 version: 20.8.9 + '@typescript-eslint/eslint-plugin': + specifier: ^6.9.0 + version: 6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/parser': + specifier: ^6.9.0 + version: 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@vitest/coverage-v8': + specifier: ^0.34.6 + version: 0.34.6(vitest@1.0.0-beta.3) + '@vitest/ui': + specifier: ^0.34.6 + version: 0.34.6(vitest@1.0.0-beta.3) aws-sdk-client-mock: specifier: ^3.0.0 version: 3.0.0 @@ -38,8 +50,8 @@ devDependencies: specifier: ^5.2.2 version: 5.2.2 vitest: - specifier: ^0.34.6 - version: 0.34.6 + specifier: ^v1.0.0-beta.3 + version: 1.0.0-beta.3(@types/node@20.8.9)(@vitest/ui@0.34.6) packages: @@ -48,6 +60,14 @@ packages: engines: {node: '>=0.10.0'} dev: true + /@ampproject/remapping@2.2.1: + resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + /@aws-crypto/crc32@3.0.0: resolution: {integrity: sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==} dependencies: @@ -669,6 +689,10 @@ packages: js-tokens: 4.0.0 dev: true + /@bcoe/v8-coverage@0.2.3: + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + dev: true + /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -929,6 +953,11 @@ packages: engines: {node: '>=6.9.0'} dev: true + /@istanbuljs/schema@0.1.3: + resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} + engines: {node: '>=8'} + dev: true + /@jest/schemas@29.6.3: resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -936,10 +965,36 @@ packages: '@sinclair/typebox': 0.27.8 dev: true + /@jridgewell/gen-mapping@0.3.3: + resolution: {integrity: sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.20 + dev: true + + /@jridgewell/resolve-uri@3.1.1: + resolution: {integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.1.2: + resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} + engines: {node: '>=6.0.0'} + dev: true + /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} dev: true + /@jridgewell/trace-mapping@0.3.20: + resolution: {integrity: sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==} + dependencies: + '@jridgewell/resolve-uri': 3.1.1 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -1009,6 +1064,10 @@ packages: dev: true optional: true + /@polka/url@1.0.0-next.23: + resolution: {integrity: sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg==} + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -1517,14 +1576,8 @@ packages: resolution: {integrity: sha512-WtKtokg1FM8SKWrMbkvXBoO+1uXsBT0IefZivoA8YG0Tvmx7hBkfpog66hpeB1VMj9Gwv1EBp/FZJ8yxD752LA==} dev: true - /@types/chai-subset@1.3.4: - resolution: {integrity: sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==} - dependencies: - '@types/chai': 4.3.9 - dev: true - - /@types/chai@4.3.9: - resolution: {integrity: sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==} + /@types/istanbul-lib-coverage@2.0.5: + resolution: {integrity: sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==} dev: true /@types/json-schema@7.0.14: @@ -1559,6 +1612,56 @@ packages: resolution: {integrity: sha512-GDV68H0mBSN449sa5HEj51E0wfpVQb8xNSMzxf/PrypMFcLTMwJMOM/cgXiv71Mq5drkOQmUGvL1okOZcu6RrQ==} dev: true + /@typescript-eslint/eslint-plugin@6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.52.0)(typescript@5.2.2): + resolution: {integrity: sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@eslint-community/regexpp': 4.10.0 + '@typescript-eslint/parser': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/scope-manager': 6.9.0 + '@typescript-eslint/type-utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/utils': 6.9.0(eslint@8.52.0)(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.9.0 + debug: 4.3.4 + eslint: 8.52.0 + graphemer: 1.4.0 + ignore: 5.2.4 + natural-compare: 1.4.0 + semver: 7.5.4 + ts-api-utils: 1.0.3(typescript@5.2.2) + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@typescript-eslint/parser@6.9.0(eslint@8.52.0)(typescript@5.2.2): + resolution: {integrity: sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==} + engines: {node: ^16.0.0 || >=18.0.0} + peerDependencies: + eslint: ^7.0.0 || ^8.0.0 + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + '@typescript-eslint/scope-manager': 6.9.0 + '@typescript-eslint/types': 6.9.0 + '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) + '@typescript-eslint/visitor-keys': 6.9.0 + debug: 4.3.4 + eslint: 8.52.0 + typescript: 5.2.2 + transitivePeerDependencies: + - supports-color + dev: true + /@typescript-eslint/scope-manager@6.9.0: resolution: {integrity: sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==} engines: {node: ^16.0.0 || >=18.0.0} @@ -1644,36 +1747,72 @@ packages: resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} dev: true - /@vitest/expect@0.34.6: - resolution: {integrity: sha512-QUzKpUQRc1qC7qdGo7rMK3AkETI7w18gTCUrsNnyjjJKYiuUB9+TQK3QnR1unhCnWRC0AbKv2omLGQDF/mIjOw==} + /@vitest/coverage-v8@0.34.6(vitest@1.0.0-beta.3): + resolution: {integrity: sha512-fivy/OK2d/EsJFoEoxHFEnNGTg+MmdZBAVK9Ka4qhXR2K3J0DS08vcGVwzDtXSuUMabLv4KtPcpSKkcMXFDViw==} + peerDependencies: + vitest: '>=0.32.0 <1' + dependencies: + '@ampproject/remapping': 2.2.1 + '@bcoe/v8-coverage': 0.2.3 + istanbul-lib-coverage: 3.2.0 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 4.0.1 + istanbul-reports: 3.1.6 + magic-string: 0.30.5 + picocolors: 1.0.0 + std-env: 3.4.3 + test-exclude: 6.0.0 + v8-to-istanbul: 9.1.3 + vitest: 1.0.0-beta.3(@types/node@20.8.9)(@vitest/ui@0.34.6) + transitivePeerDependencies: + - supports-color + dev: true + + /@vitest/expect@1.0.0-beta.3: + resolution: {integrity: sha512-fbDKa7aj/xiCcS9X6RwlPXTZ5SNQpvPl0eswD+d3Lnp8gmuB8j2mb+CDUMe7VRg+ah5Cm/kqAc9DzYTe2IcvgQ==} dependencies: - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 + '@vitest/spy': 1.0.0-beta.3 + '@vitest/utils': 1.0.0-beta.3 chai: 4.3.10 dev: true - /@vitest/runner@0.34.6: - resolution: {integrity: sha512-1CUQgtJSLF47NnhN+F9X2ycxUP0kLHQ/JWvNHbeBfwW8CzEGgeskzNnHDyv1ieKTltuR6sdIHV+nmR6kPxQqzQ==} + /@vitest/runner@1.0.0-beta.3: + resolution: {integrity: sha512-9xakpVjEpuFiyoCt42d0Ff/PiPOlBLQeKjEZbnT3LURi1M26llNVZ2I9ogDQipH3EH9IK0/xDfYAxOjs2jYaDw==} dependencies: - '@vitest/utils': 0.34.6 + '@vitest/utils': 1.0.0-beta.3 p-limit: 4.0.0 pathe: 1.1.1 dev: true - /@vitest/snapshot@0.34.6: - resolution: {integrity: sha512-B3OZqYn6k4VaN011D+ve+AA4whM4QkcwcrwaKwAbyyvS/NB1hCWjFIBQxAQQSQir9/RtyAAGuq+4RJmbn2dH4w==} + /@vitest/snapshot@1.0.0-beta.3: + resolution: {integrity: sha512-fun2daxMGuXo2wBi6ItFgUFl0xnN4v2hVXvIYGvoJG9SoPobfPlQ79MO8gMKOt++rWlUXNj7J23KHcoOyZ2Wwg==} dependencies: magic-string: 0.30.5 pathe: 1.1.1 pretty-format: 29.7.0 dev: true - /@vitest/spy@0.34.6: - resolution: {integrity: sha512-xaCvneSaeBw/cz8ySmF7ZwGvL0lBjfvqc1LpQ/vcdHEvpLn3Ff1vAvjw+CoGn0802l++5L/pxb7whwcWAw+DUQ==} + /@vitest/spy@1.0.0-beta.3: + resolution: {integrity: sha512-ybwJagwd1f3awJixX9YWdGtZNHXbJozzEekRfYdHmTudPgIX5bxFCcH4cG/gtGY6VbVuvExwk0Es04bFx2YkLA==} dependencies: tinyspy: 2.2.0 dev: true + /@vitest/ui@0.34.6(vitest@1.0.0-beta.3): + resolution: {integrity: sha512-/fxnCwGC0Txmr3tF3BwAbo3v6U2SkBTGR9UB8zo0Ztlx0BTOXHucE0gDHY7SjwEktCOHatiGmli9kZD6gYSoWQ==} + peerDependencies: + vitest: '>=0.30.1 <1' + dependencies: + '@vitest/utils': 0.34.6 + fast-glob: 3.3.1 + fflate: 0.8.1 + flatted: 3.2.9 + pathe: 1.1.1 + picocolors: 1.0.0 + sirv: 2.0.3 + vitest: 1.0.0-beta.3(@types/node@20.8.9)(@vitest/ui@0.34.6) + dev: true + /@vitest/utils@0.34.6: resolution: {integrity: sha512-IG5aDD8S6zlvloDsnzHw0Ut5xczlF+kv2BOTo+iXfPr54Yhi5qbVOgGB1hZaVq4iJ4C/MZ2J0y15IlsV/ZcI0A==} dependencies: @@ -1682,6 +1821,14 @@ packages: pretty-format: 29.7.0 dev: true + /@vitest/utils@1.0.0-beta.3: + resolution: {integrity: sha512-8j7Xg3A13kt78DqWJC3ludyMsBbKQn/LcX9wcULxZFMGQqmSkUFN8ij6JWFQs67w39T+clLWzPrV+NRxe+Mc9g==} + dependencies: + diff-sequences: 29.6.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + dev: true + /JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -2092,6 +2239,10 @@ packages: q: 1.5.1 dev: true + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + dev: true + /core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} dev: true @@ -2383,6 +2534,10 @@ packages: reusify: 1.0.4 dev: true + /fflate@0.8.1: + resolution: {integrity: sha512-/exOvEuc+/iaUm105QIiOt4LpBdMTWsXxqR0HDF35vx3fmaKzw7354gTilCh5rkzEt8WYyG//ku3h3nRmd7CHQ==} + dev: true + /figures@3.2.0: resolution: {integrity: sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==} engines: {node: '>=8'} @@ -2616,6 +2771,10 @@ packages: lru-cache: 6.0.0 dev: true + /html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + dev: true + /ignore@5.2.4: resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} engines: {node: '>= 4'} @@ -2720,6 +2879,39 @@ packages: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} dev: true + /istanbul-lib-coverage@3.2.0: + resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} + engines: {node: '>=8'} + dev: true + + /istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + dependencies: + istanbul-lib-coverage: 3.2.0 + make-dir: 4.0.0 + supports-color: 7.2.0 + dev: true + + /istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} + dependencies: + debug: 4.3.4 + istanbul-lib-coverage: 3.2.0 + source-map: 0.6.1 + transitivePeerDependencies: + - supports-color + dev: true + + /istanbul-reports@3.1.6: + resolution: {integrity: sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==} + engines: {node: '>=8'} + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + dev: true + /js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} dev: true @@ -2872,6 +3064,13 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true + /make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + dependencies: + semver: 7.5.4 + dev: true + /map-obj@1.0.1: resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} engines: {node: '>=0.10.0'} @@ -2950,6 +3149,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /mrmime@1.0.1: + resolution: {integrity: sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw==} + engines: {node: '>=10'} + dev: true + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -3397,6 +3601,15 @@ packages: supports-color: 7.2.0 dev: true + /sirv@2.0.3: + resolution: {integrity: sha512-O9jm9BsID1P+0HOi81VpXPoDxYP374pkOLzACAoyUQ/3OUVndNpsz6wMnY2z+yOxzbllCKZrM+9QrWsv4THnyA==} + engines: {node: '>= 10'} + dependencies: + '@polka/url': 1.0.0-next.23 + mrmime: 1.0.1 + totalist: 3.0.1 + dev: true + /slash@3.0.0: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} @@ -3554,6 +3767,15 @@ packages: engines: {node: '>= 0.4'} dev: true + /test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} + dependencies: + '@istanbuljs/schema': 0.1.3 + glob: 7.2.3 + minimatch: 3.1.2 + dev: true + /text-extensions@1.9.0: resolution: {integrity: sha512-wiBrwC1EhBelW12Zy26JeOUkQ5mRu+5o8rpsJk5+2t+Y5vE7e842qtZDQ2g1NpX/29HdyFeJ4nSIhI47ENSxlQ==} engines: {node: '>=0.10'} @@ -3584,8 +3806,8 @@ packages: resolution: {integrity: sha512-65NKvSuAVDP/n4CqH+a9w2kTlLReS9vhsAP06MWx+/89nMinJyB2icyl58RIcqCmIggpojIGeuJGhjU1aGMBSg==} dev: true - /tinypool@0.7.0: - resolution: {integrity: sha512-zSYNUlYSMhJ6Zdou4cJwo/p7w5nmAH17GRfU/ui3ctvjXFErXXkruT4MWW6poDeXgCaIBlGLrfU6TbTXxyGMww==} + /tinypool@0.8.1: + resolution: {integrity: sha512-zBTCK0cCgRROxvs9c0CGK838sPkeokNGdQVUUwHAbynHFlmyJYj825f/oRs528HaIJ97lo0pLIlDUzwN+IorWg==} engines: {node: '>=14.0.0'} dev: true @@ -3601,6 +3823,11 @@ packages: is-number: 7.0.0 dev: true + /totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + dev: true + /trim-newlines@3.0.1: resolution: {integrity: sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==} engines: {node: '>=8'} @@ -3695,6 +3922,15 @@ packages: hasBin: true dev: false + /v8-to-istanbul@9.1.3: + resolution: {integrity: sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==} + engines: {node: '>=10.12.0'} + dependencies: + '@jridgewell/trace-mapping': 0.3.20 + '@types/istanbul-lib-coverage': 2.0.5 + convert-source-map: 2.0.0 + dev: true + /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: @@ -3702,9 +3938,9 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@0.34.6(@types/node@20.8.9): - resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} - engines: {node: '>=v14.18.0'} + /vite-node@1.0.0-beta.3(@types/node@20.8.9): + resolution: {integrity: sha512-qpdoB+N9LV2Lr3W6k8vZwm/lN3hdmz+c0Tixh2ktnX/ywF0OkQf7wIWLeiFLvW4Fa/iw4qhye7xiBBMP1o6/sA==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true dependencies: cac: 6.7.14 @@ -3760,22 +3996,22 @@ packages: fsevents: 2.3.3 dev: true - /vitest@0.34.6: - resolution: {integrity: sha512-+5CALsOvbNKnS+ZHMXtuUC7nL8/7F1F2DnHGjSsszX8zCjWSSviphCb/NuS9Nzf4Q03KyyDRBAXhF/8lffME4Q==} - engines: {node: '>=v14.18.0'} + /vitest@1.0.0-beta.3(@types/node@20.8.9)(@vitest/ui@0.34.6): + resolution: {integrity: sha512-Ytj70kgJq1MxWpS8U33nRwF7Mngzr0NxD6J1J8WZGZrYhGRktW3t0AwbjLyFg1URiW3ds6FSp/T3C8JEnP49cA==} + engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 '@vitest/browser': '*' '@vitest/ui': '*' happy-dom: '*' jsdom: '*' - playwright: '*' - safaridriver: '*' - webdriverio: '*' peerDependenciesMeta: '@edge-runtime/vm': optional: true + '@types/node': + optional: true '@vitest/browser': optional: true '@vitest/ui': @@ -3784,21 +4020,14 @@ packages: optional: true jsdom: optional: true - playwright: - optional: true - safaridriver: - optional: true - webdriverio: - optional: true dependencies: - '@types/chai': 4.3.9 - '@types/chai-subset': 1.3.4 '@types/node': 20.8.9 - '@vitest/expect': 0.34.6 - '@vitest/runner': 0.34.6 - '@vitest/snapshot': 0.34.6 - '@vitest/spy': 0.34.6 - '@vitest/utils': 0.34.6 + '@vitest/expect': 1.0.0-beta.3 + '@vitest/runner': 1.0.0-beta.3 + '@vitest/snapshot': 1.0.0-beta.3 + '@vitest/spy': 1.0.0-beta.3 + '@vitest/ui': 0.34.6(vitest@1.0.0-beta.3) + '@vitest/utils': 1.0.0-beta.3 acorn: 8.11.2 acorn-walk: 8.3.0 cac: 6.7.14 @@ -3811,9 +4040,9 @@ packages: std-env: 3.4.3 strip-literal: 1.3.0 tinybench: 2.5.1 - tinypool: 0.7.0 + tinypool: 0.8.1 vite: 4.5.0(@types/node@20.8.9) - vite-node: 0.34.6(@types/node@20.8.9) + vite-node: 1.0.0-beta.3(@types/node@20.8.9) why-is-node-running: 2.2.2 transitivePeerDependencies: - less diff --git a/tests/integration/s3-simpler.integ.test.ts b/tests/integration/s3-simpler.integ.test.ts index a6ce6ca..8d94239 100644 --- a/tests/integration/s3-simpler.integ.test.ts +++ b/tests/integration/s3-simpler.integ.test.ts @@ -11,7 +11,7 @@ describe.only('integration', () =>{ */ const bucketName = 'super-random-test-bucket-12345'; const s3 = new S3Client({ region: 'eu-central-1' }); - const fileName = 'test.jpg'; + const fileName = 'tests/test.jpg'; const dirname = path.dirname(__filename); const FilePath = path.join(dirname, '..', '..', fileName); diff --git a/test.jpg b/tests/test.jpg similarity index 100% rename from test.jpg rename to tests/test.jpg diff --git a/tests/unit/createMultipartUploads.test.ts b/tests/unit/createMultipartUploads.test.ts index e42d36f..70bfddc 100644 --- a/tests/unit/createMultipartUploads.test.ts +++ b/tests/unit/createMultipartUploads.test.ts @@ -11,7 +11,7 @@ import { } from '../../src/createMultipartUploads'; const bucketName = 'bucketName'; -const fileName = 'test.jpg'; +const fileName = 'tests/test.jpg'; const key = fileName; const s3Mock = mockClient(S3Client); diff --git a/tests/unit/generatePresignedUrl.test.ts b/tests/unit/generatePresignedUrl.test.ts index cf8697f..cc72cdc 100644 --- a/tests/unit/generatePresignedUrl.test.ts +++ b/tests/unit/generatePresignedUrl.test.ts @@ -5,13 +5,13 @@ import { PresignedUrl, } from '../../src/generatePresignedUrl'; -jest.mock('@aws-sdk/s3-request-presigner', () => ({ - ...jest.requireActual('@aws-sdk/s3-request-presigner'), - getSignedUrl: jest.fn().mockResolvedValue('testUrl'), +vi.mock('@aws-sdk/s3-request-presigner', () => ({ + ...vi.importActual('@aws-sdk/s3-request-presigner'), + getSignedUrl: vi.fn().mockResolvedValue('testUrl'), })); const bucketName = 'bucketName'; -const fileName = 'test.jpg'; +const fileName = 'tests/test.jpg'; const key = fileName; const s3Mock = mockClient(S3Client); diff --git a/tests/unit/uploadMultipart.test.ts b/tests/unit/uploadMultipart.test.ts index 061f93e..9c042b3 100644 --- a/tests/unit/uploadMultipart.test.ts +++ b/tests/unit/uploadMultipart.test.ts @@ -6,7 +6,7 @@ import { } from '../../src/uploadMultipart'; const bucketName = 'bucketName'; -const fileName = 'test.jpg'; +const fileName = 'tests/test.jpg'; const key = fileName; const s3Mock = mockClient(S3Client); diff --git a/tests/unit/uploadToS3.test.ts b/tests/unit/uploadToS3.test.ts index 2994ea4..3996289 100644 --- a/tests/unit/uploadToS3.test.ts +++ b/tests/unit/uploadToS3.test.ts @@ -11,13 +11,13 @@ import { mockClient } from 'aws-sdk-client-mock'; import { CreateMultipartUpload } from '../../src/createMultipartUploads'; import { uploadToS3 } from '../../src/uploadToS3'; -jest.mock('../../src/generatePresignedUrl', () => ({ - ...jest.requireActual('../../src/generatePresignedUrl'), - generatePresignedUrl: jest.fn().mockResolvedValue('testUrl'), +vi.mock('../../src/generatePresignedUrl', () => ({ + ...vi.importActual('../../src/generatePresignedUrl'), + generatePresignedUrl: vi.fn().mockResolvedValue('testUrl'), })); const bucketName = 'unique-bucket-name'; -const fileName = 'test.jpg'; +const fileName = 'tests/test.jpg'; const Key = fileName; const s3Mock = mockClient(S3Client); @@ -76,7 +76,11 @@ describe('s3Actions', () => { afterAll(() => { const multipart = path.join(folder, '..', '..', `${fileName}.part-aa`); - unlinkSync(multipart); + if(!multipart){ + return; + }else { + unlinkSync(multipart); + } }); }); }); diff --git a/tests/vitest.config.integ.ts b/tests/vitest.config.integ.ts new file mode 100644 index 0000000..d701358 --- /dev/null +++ b/tests/vitest.config.integ.ts @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + include: ["**/tests/integration/*.test.ts"], + }, +}) \ No newline at end of file diff --git a/tests/vitest.config.ts b/tests/vitest.config.ts new file mode 100644 index 0000000..3465d98 --- /dev/null +++ b/tests/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + globals: true, + include: ["**/tests/unit/*.test.ts"], + coverage: { + provider: 'v8' + }, + }, +}) \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index ba396eb..e913967 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,3 +1,6 @@ { - "extends": "@tsconfig/bun/tsconfig.json" + "extends": "@tsconfig/bun/tsconfig.json", + "compilerOptions": { + "types": ["vitest/globals"] + } }