diff --git a/package-lock.json b/package-lock.json
index 91c895f89..d28c42b12 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -33,6 +33,7 @@
"@types/json-stringify-safe": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
+ "@vitest/coverage-v8": "^2.1.8",
"contentful-sdk-jsdoc": "^3.1.2",
"cz-conventional-changelog": "^3.3.0",
"es-check": "^7.0.0",
@@ -68,7 +69,6 @@
"integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
"dev": true,
"license": "Apache-2.0",
- "peer": true,
"dependencies": {
"@jridgewell/gen-mapping": "^0.3.5",
"@jridgewell/trace-mapping": "^0.3.24"
@@ -1556,6 +1556,13 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@bcoe/v8-coverage": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
+ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@colors/colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
@@ -2567,6 +2574,16 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
+ "node_modules/@istanbuljs/schema": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz",
+ "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/@jest/schemas": {
"version": "29.6.3",
"resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",
@@ -4244,6 +4261,39 @@
"integrity": "sha512-P7mafQXjkrsoyTRppnt0N21udKS9wUmLXHRyP9saLXLHw32j/FgUJ3FscSWgvSqRs4cj7wKZtwqJEvWJ2jbGmA==",
"license": "MPL-2.0"
},
+ "node_modules/@vitest/coverage-v8": {
+ "version": "2.1.8",
+ "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.8.tgz",
+ "integrity": "sha512-2Y7BPlKH18mAZYAW1tYByudlCYrQyl5RGvnnDYJKW5tCiO5qg3KSAy3XAxcxKz900a0ZXxWtKrMuZLe3lKBpJw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@ampproject/remapping": "^2.3.0",
+ "@bcoe/v8-coverage": "^0.2.3",
+ "debug": "^4.3.7",
+ "istanbul-lib-coverage": "^3.2.2",
+ "istanbul-lib-report": "^3.0.1",
+ "istanbul-lib-source-maps": "^5.0.6",
+ "istanbul-reports": "^3.1.7",
+ "magic-string": "^0.30.12",
+ "magicast": "^0.3.5",
+ "std-env": "^3.8.0",
+ "test-exclude": "^7.0.1",
+ "tinyrainbow": "^1.2.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@vitest/browser": "2.1.8",
+ "vitest": "2.1.8"
+ },
+ "peerDependenciesMeta": {
+ "@vitest/browser": {
+ "optional": true
+ }
+ }
+ },
"node_modules/@vitest/expect": {
"version": "2.1.8",
"resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz",
@@ -8358,6 +8408,13 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/html-escaper": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/html-void-elements": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-3.0.0.tgz",
@@ -9171,6 +9228,83 @@
"node": ">=10.13"
}
},
+ "node_modules/istanbul-lib-coverage": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
+ "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-report": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
+ "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^4.0.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-lib-report/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-report/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-source-maps": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz",
+ "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "^0.3.23",
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-reports": {
+ "version": "3.1.7",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz",
+ "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/jackspeak": {
"version": "3.4.3",
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
@@ -9794,6 +9928,47 @@
"@jridgewell/sourcemap-codec": "^1.5.0"
}
},
+ "node_modules/magicast": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz",
+ "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.25.4",
+ "@babel/types": "^7.25.4",
+ "source-map-js": "^1.2.0"
+ }
+ },
+ "node_modules/make-dir": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
+ "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/make-dir/node_modules/semver": {
+ "version": "7.7.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.0.tgz",
+ "integrity": "sha512-DrfFnPzblFmNrIZzg5RzHegbiRWg7KMR7btwi2yjHwx06zsUbO5g613sVwEV7FTwmzJu+Io0lJe2GJ3LxqpvBQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/map-obj": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz",
@@ -15284,6 +15459,21 @@
"node": ">=10"
}
},
+ "node_modules/test-exclude": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz",
+ "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^10.4.1",
+ "minimatch": "^9.0.4"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/text-extensions": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/text-extensions/-/text-extensions-2.4.0.tgz",
diff --git a/package.json b/package.json
index a1026b4a9..9489cdc71 100644
--- a/package.json
+++ b/package.json
@@ -66,23 +66,26 @@
"prettier": "prettier --write '**/*.{jsx,js,ts,tsx}'",
"prettier:check": "prettier --check '**/*.{jsx,js,ts,tsx}'",
"pretest": "rimraf coverage",
- "test": "npm run test:unit && npm run test:integration && npm run lint && npm run test:types",
- "test:unit": "vitest --run ./test/unit",
- "test:unit:watch": "vitest ./test/unit",
- "test:integration": "vitest --run ./test/integration",
- "test:integration:watch": "vitest ./test/integration",
+ "test": "npm run lint && npm run test:cover-unit && npm run test:types && npm run test:cover-integration && npm run test:size",
+ "test:cover-unit": "npm run test:unit -- --coverage",
+ "test:cover-integration": "npm run test:integration -- --coverage",
+ "test:unit": "npx vitest --project unit --run",
+ "test:types": "npx vitest --project types --run",
+ "test:unit-watch": "npx vitest --project unit",
+ "test:integration": "npx vitest --project integration --run --no-file-parallelism",
+ "test:integration-watch": "npx vitest --project integration --no-file-parallelism",
+ "test:browser": "npx playwright install && npx vitest --project browser-unit --run && npx vitest --project browser-integration --run",
+ "test:version": "grep -r \"0.0.0-determined-by-semantic-release\" ./dist > /dev/null && echo \"version 0.0.0-determined-by-semantic-release found in output\" && exit 1 || exit 0",
"test:size": "size-limit",
"test:demo-projects": "npm run test:demo-node && npm run test:demo-browser",
"test:demo-node": "rimraf ./test/output-integration/node/node-modules && npm --prefix ./test/output-integration/node ci && vitest --run ./test/output-integration/node",
"test:demo-browser": "rimraf ./test/output-integration/browser/node-modules && npm --prefix ./test/output-integration/browser ci && npm --prefix ./test/output-integration/browser run test",
- "test:types": "tsd",
"test:prepush": "npm run build && npm run test:unit && npm run test:types",
- "prepublishOnly": "export PUBLISH_RUN=true && npm run build && unset PUBLISH_RUN",
+ "prepublishOnly": "export PUBLISH_RUN=true && npm run build && unset PUBLISH_RUN && npm run test:version",
"postpublish": "npm run docs:publish && npm run clean",
"semantic-release": "semantic-release",
"prepare": "husky",
- "precommit": "npm run lint && npm run prettier:check",
- "prepush": "npm run test:prepush"
+ "precommit": "npm run lint && npm run prettier:check"
},
"dependencies": {
"@contentful/content-source-maps": "^0.11.7",
@@ -109,6 +112,7 @@
"@types/json-stringify-safe": "^5.0.0",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
+ "@vitest/coverage-v8": "^2.1.8",
"contentful-sdk-jsdoc": "^3.1.2",
"cz-conventional-changelog": "^3.3.0",
"es-check": "^7.0.0",
diff --git a/test/types/asset-d.ts b/test/types/asset-d.ts
index 5684ec4db..2e1b4b14c 100644
--- a/test/types/asset-d.ts
+++ b/test/types/asset-d.ts
@@ -1,8 +1,4 @@
-// As tsd does not pick up the global.d.ts located in /lib we
-// explicitly reference it here once.
-// eslint-disable-next-line @typescript-eslint/triple-slash-reference
-///
-import { expectAssignable, expectNotAssignable } from 'tsd'
+import { expectTypeOf, test } from "vitest";
import {
Asset,
@@ -31,75 +27,84 @@ const assetCollectionWithAllLocales = {
limit: mocks.numberValue,
items: [mocks.localizedAsset],
}
-
-expectAssignable(mocks.assetDetails)
-expectAssignable(mocks.assetFile)
-expectAssignable(mocks.assetFields)
-
-expectAssignable>(mocks.asset)
-expectAssignable>(mocks.localizedAsset)
-
-expectAssignable>(mocks.asset)
-expectAssignable>(mocks.localizedAsset)
-
-expectAssignable>(assetCollection)
-expectAssignable>(assetCollectionWithAllLocales)
-
-expectAssignable>(assetCollection)
-expectAssignable>(assetCollectionWithAllLocales)
-
-expectNotAssignable>(mocks.asset)
-expectAssignable>(mocks.localizedAsset)
-
-expectNotAssignable>(
- mocks.asset,
-)
-expectAssignable>(
- mocks.localizedAsset,
-)
-
-expectNotAssignable>(
- mocks.asset,
-)
-expectAssignable>(
- mocks.localizedAsset,
-)
-
-expectNotAssignable>(assetCollection)
-expectAssignable>(assetCollectionWithAllLocales)
-
-expectNotAssignable>(
- assetCollection,
-)
-expectAssignable>(
- assetCollectionWithAllLocales,
-)
-
-expectNotAssignable<
- AssetCollection<'WITH_ALL_LOCALES' | 'WITHOUT_UNRESOLVABLE_LINKS', AssetLocales>
->(assetCollection)
-expectAssignable>(
- assetCollectionWithAllLocales,
-)
-
-expectAssignable>(mocks.asset)
-expectNotAssignable>(mocks.localizedAsset)
-
-expectAssignable>(mocks.asset)
-expectNotAssignable>(mocks.localizedAsset)
-
-expectAssignable>(mocks.asset)
-expectNotAssignable>(mocks.localizedAsset)
-
-expectAssignable>(assetCollection)
-expectNotAssignable>(
- assetCollectionWithAllLocales,
-)
-
-expectAssignable>(assetCollection)
-expectNotAssignable>(assetCollectionWithAllLocales)
-
-expectAssignable>(assetCollection)
-expectNotAssignable>(
- assetCollectionWithAllLocales,
-)
+test('asset', async () => {
+ expectTypeOf(mocks.assetDetails)
+ expectTypeOf(mocks.assetFile)
+ expectTypeOf(mocks.assetFields)
+
+ expectTypeOf>(mocks.asset)
+ expectTypeOf>(mocks.localizedAsset)
+
+ expectTypeOf>(mocks.asset)
+ expectTypeOf>(mocks.localizedAsset)
+
+ expectTypeOf>(assetCollection)
+ expectTypeOf>(assetCollectionWithAllLocales)
+
+ expectTypeOf>(assetCollection)
+ expectTypeOf>(assetCollectionWithAllLocales)
+
+ expectTypeOf(mocks.asset).not.toEqualTypeOf>()
+ expectTypeOf>(mocks.localizedAsset)
+
+ expectTypeOf(mocks.asset).not.toEqualTypeOf<
+ Asset<'WITH_ALL_LOCALES' | 'WITHOUT_LINK_RESOLUTION', AssetLocales>
+ >()
+ expectTypeOf>(
+ mocks.localizedAsset,
+ )
+
+ expectTypeOf(mocks.asset).not.toEqualTypeOf<
+ Asset<'WITH_ALL_LOCALES' | 'WITHOUT_UNRESOLVABLE_LINKS', AssetLocales>
+ >()
+ expectTypeOf>(
+ mocks.localizedAsset,
+ )
+
+ expectTypeOf(assetCollection).not.toEqualTypeOf<
+ AssetCollection<'WITH_ALL_LOCALES', AssetLocales>
+ >()
+ expectTypeOf>(assetCollectionWithAllLocales)
+
+ expectTypeOf(assetCollection).not.toEqualTypeOf<
+ AssetCollection<'WITH_ALL_LOCALES' | 'WITHOUT_LINK_RESOLUTION', AssetLocales>
+ >()
+ expectTypeOf>(
+ assetCollectionWithAllLocales,
+ )
+
+ expectTypeOf(assetCollection).not.toEqualTypeOf<
+ AssetCollection<'WITH_ALL_LOCALES' | 'WITHOUT_UNRESOLVABLE_LINKS', AssetLocales>
+ >()
+ expectTypeOf>(
+ assetCollectionWithAllLocales,
+ )
+
+ expectTypeOf>(mocks.asset)
+ expectTypeOf(mocks.localizedAsset).not.toEqualTypeOf<
+ Asset<'WITHOUT_LINK_RESOLUTION', AssetLocales>
+ >()
+
+ expectTypeOf>(mocks.asset)
+ expectTypeOf(mocks.localizedAsset).not.toEqualTypeOf>()
+
+ expectTypeOf>(mocks.asset)
+ expectTypeOf(mocks.localizedAsset).not.toEqualTypeOf<
+ Asset<'WITHOUT_UNRESOLVABLE_LINKS', AssetLocales>
+ >()
+
+ expectTypeOf>(assetCollection)
+ expectTypeOf(assetCollectionWithAllLocales).not.toEqualTypeOf<
+ AssetCollection<'WITHOUT_LINK_RESOLUTION', AssetLocales>
+ >()
+
+ expectTypeOf>(assetCollection)
+ expectTypeOf(assetCollectionWithAllLocales).not.toEqualTypeOf<
+ AssetCollection
+ >()
+
+ expectTypeOf>(assetCollection)
+ expectTypeOf(assetCollectionWithAllLocales).not.toEqualTypeOf<
+ AssetCollection<'WITHOUT_UNRESOLVABLE_LINKS', AssetLocales>
+ >()
+})
\ No newline at end of file
diff --git a/test/types/chain-options.test-d.ts b/test/types/chain-options.test-d.ts
index e6f271a19..e10047f50 100644
--- a/test/types/chain-options.test-d.ts
+++ b/test/types/chain-options.test-d.ts
@@ -1,53 +1,55 @@
-import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'
+import { expectTypeOf, test } from "vitest";
import { ChainOption, ChainOptions } from '../../lib/utils/client-helpers'
import { ChainModifiers } from '../../lib'
-expectNotAssignable('ANY_STRING')
-
-expectAssignable({
- withoutLinkResolution: true as boolean,
- withAllLocales: true as boolean,
- withoutUnresolvableLinks: true as boolean,
-})
-
-expectType>({
- withoutLinkResolution: false,
- withAllLocales: false,
- withoutUnresolvableLinks: false,
-})
-
-expectType>({
- withoutLinkResolution: false,
- withAllLocales: false,
- withoutUnresolvableLinks: true,
-})
-
-expectType>({
- withoutLinkResolution: true,
- withAllLocales: false,
- withoutUnresolvableLinks: false,
-})
-
-expectType>({
- withoutLinkResolution: false,
- withAllLocales: true,
- withoutUnresolvableLinks: false,
-})
-
-expectType>({
- withoutLinkResolution: false,
- withAllLocales: true,
- withoutUnresolvableLinks: true,
-})
-
-expectNotType>({
- withoutLinkResolution: false,
- withAllLocales: true,
- withoutUnresolvableLinks: false,
-})
-
-expectType>({
- withoutLinkResolution: true,
- withAllLocales: true,
- withoutUnresolvableLinks: false,
-})
+test('chain-options', async () => {
+ expectTypeOf('ANY_STRING').not.toEqualTypeOf()
+
+ expectTypeOf({
+ withoutLinkResolution: true as boolean,
+ withAllLocales: true as boolean,
+ withoutUnresolvableLinks: true as boolean,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: false,
+ withAllLocales: false,
+ withoutUnresolvableLinks: false,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: false,
+ withAllLocales: false,
+ withoutUnresolvableLinks: true,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: true,
+ withAllLocales: false,
+ withoutUnresolvableLinks: false,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: false,
+ withAllLocales: true,
+ withoutUnresolvableLinks: false,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: false,
+ withAllLocales: true,
+ withoutUnresolvableLinks: true,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: false,
+ withAllLocales: true,
+ withoutUnresolvableLinks: false,
+ })
+
+ expectTypeOf>({
+ withoutLinkResolution: true,
+ withAllLocales: true,
+ withoutUnresolvableLinks: false,
+ })
+})
\ No newline at end of file
diff --git a/test/types/client/createClient.test-d.ts b/test/types/client/createClient.test-d.ts
index 81ba2894f..c02f247ef 100644
--- a/test/types/client/createClient.test-d.ts
+++ b/test/types/client/createClient.test-d.ts
@@ -1,4 +1,4 @@
-import { expectType } from 'tsd'
+import { expectTypeOf, test } from 'vitest'
import { ContentfulClientApi, createClient } from '../../../lib'
@@ -7,51 +7,57 @@ const CLIENT_OPTIONS = {
space: 'spaceId',
}
-expectType>(createClient(CLIENT_OPTIONS))
-
-expectType>(
- createClient(CLIENT_OPTIONS).withoutLinkResolution,
-)
-expectType(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutLinkResolution)
-expectType(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutUnresolvableLinks)
-
-expectType>(
- createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales,
-)
-expectType(
- createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
-)
-expectType(createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withAllLocales)
-expectType(
- createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
-)
-
-expectType>(
- createClient(CLIENT_OPTIONS).withoutUnresolvableLinks,
-)
-expectType(createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutUnresolvableLinks)
-expectType(createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutLinkResolution)
-
-expectType>(
- createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales,
-)
-expectType(
- createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutUnresolvableLinks,
-)
-expectType(
- createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withAllLocales,
-)
-expectType(
- createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutLinkResolution,
-)
-
-expectType>(createClient(CLIENT_OPTIONS).withAllLocales)
-expectType(createClient(CLIENT_OPTIONS).withAllLocales.withAllLocales)
-
-expectType>(
- createClient(CLIENT_OPTIONS).withAllLocales.withoutLinkResolution,
-)
-
-expectType>(
- createClient(CLIENT_OPTIONS).withAllLocales.withoutUnresolvableLinks,
-)
+test('createClient', () => {
+ expectTypeOf>(createClient(CLIENT_OPTIONS))
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withoutLinkResolution,
+ )
+ expectTypeOf(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutLinkResolution)
+ expectTypeOf(createClient(CLIENT_OPTIONS).withoutLinkResolution.withoutUnresolvableLinks)
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withAllLocales,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutLinkResolution.withAllLocales.withoutLinkResolution,
+ )
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutUnresolvableLinks,
+ )
+ expectTypeOf(createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withoutLinkResolution)
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutUnresolvableLinks,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withAllLocales,
+ )
+ expectTypeOf(
+ createClient(CLIENT_OPTIONS).withoutUnresolvableLinks.withAllLocales.withoutLinkResolution,
+ )
+
+ expectTypeOf>(createClient(CLIENT_OPTIONS).withAllLocales)
+ expectTypeOf(createClient(CLIENT_OPTIONS).withAllLocales.withAllLocales)
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withAllLocales.withoutLinkResolution,
+ )
+
+ expectTypeOf>(
+ createClient(CLIENT_OPTIONS).withAllLocales.withoutUnresolvableLinks,
+ )
+})
diff --git a/test/types/client/getAssets.test-d.ts b/test/types/client/getAssets.test-d.ts
index 3a0e4af7b..96a8db020 100644
--- a/test/types/client/getAssets.test-d.ts
+++ b/test/types/client/getAssets.test-d.ts
@@ -1,4 +1,4 @@
-import { expectType } from 'tsd'
+import { expectTypeOf, test } from "vitest";
import { Asset, AssetCollection, createClient } from '../../../lib'
const client = createClient({
@@ -8,14 +8,17 @@ const client = createClient({
type Locale = 'en'
-expectType>(await client.getAsset('test'))
+test('getAssets', async () => {
-expectType>(await client.getAssets())
+expectTypeOf>(await client.getAsset('test'))
-expectType>(await client.withAllLocales.getAsset('test'))
-expectType>(await client.withAllLocales.getAsset('test'))
+expectTypeOf>(await client.getAssets())
-expectType>(await client.withAllLocales.getAssets())
-expectType>(
+expectTypeOf>(await client.withAllLocales.getAsset('test'))
+expectTypeOf>(await client.withAllLocales.getAsset('test'))
+
+expectTypeOf>(await client.withAllLocales.getAssets())
+expectTypeOf>(
await client.withAllLocales.getAssets(),
)
+})
\ No newline at end of file
diff --git a/test/types/client/getEntries.test-d.ts b/test/types/client/getEntries.test-d.ts
index 40fec8804..00ef6f1ee 100644
--- a/test/types/client/getEntries.test-d.ts
+++ b/test/types/client/getEntries.test-d.ts
@@ -1,4 +1,4 @@
-import { expectType, expectError } from 'tsd'
+import { expectTypeOf, test } from "vitest";
import { createClient, EntryCollection, Entry, EntrySkeletonType } from '../../../lib'
const client = createClient({
@@ -26,28 +26,30 @@ type TestEntrySkeleton = EntrySkeletonType
type Locale = 'en'
+test('getEntries', async () => {
+
/**
* With no extra parameters
*/
-expectType>(await client.getEntry('entry-id'))
+expectTypeOf>(await client.getEntry('entry-id'))
-expectType>(
+expectTypeOf>(
await client.getEntry('entry-id'),
)
-expectType>(await client.getEntries())
+expectTypeOf>(await client.getEntries())
-expectType>(
+expectTypeOf>(
await client.getEntries(),
)
-expectType>((await client.getEntries()).includes!.Entry![0])
+expectTypeOf>((await client.getEntries()).includes!.Entry![0])
-expectType>(
+expectTypeOf>(
await client.getEntries({ content_type: 'content-type-id' }),
)
expectError(await client.getEntries({ content_type: 'unexpected' }))
-expectType>(
+expectTypeOf>(
await client.getEntries({
content_type: 'content-type-id',
}),
@@ -56,118 +58,118 @@ expectType>(
/**
* Without unresolvable Links
*/
-expectType>(
+expectTypeOf>(
await client.withoutUnresolvableLinks.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withoutUnresolvableLinks.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withoutUnresolvableLinks.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withoutUnresolvableLinks.getEntries(),
)
-expectType>(
+expectTypeOf>(
(await client.withoutUnresolvableLinks.getEntries()).includes!.Entry![0],
)
/**
* Without link resolution
*/
-expectType>(
+expectTypeOf>(
await client.withoutLinkResolution.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withoutLinkResolution.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withoutLinkResolution.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withoutLinkResolution.getEntries(),
)
-expectType>(
+expectTypeOf>(
(await client.withoutLinkResolution.getEntries()).includes!.Entry![0],
)
/**
* With all Locales
*/
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.getEntries(),
)
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.getEntries()).includes!.Entry![0],
)
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.getEntries()).includes!.Entry![0],
)
/**
* With all Locales and without unresolvable Links
*/
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutUnresolvableLinks.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutUnresolvableLinks.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutUnresolvableLinks.getEntry(
'entry-id',
),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutUnresolvableLinks.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutUnresolvableLinks.getEntries(),
)
-expectType<
+expectTypeOf<
EntryCollection
>(await client.withAllLocales.withoutUnresolvableLinks.getEntries())
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.withoutUnresolvableLinks.getEntries()).includes!
.Entry![0],
)
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.withoutUnresolvableLinks.getEntries())
.includes!.Entry![0],
)
@@ -175,35 +177,35 @@ expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutLinkResolution.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutLinkResolution.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutLinkResolution.getEntry('entry-id'),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutLinkResolution.getEntries(),
)
-expectType>(
+expectTypeOf>(
await client.withAllLocales.withoutLinkResolution.getEntries(),
)
-expectType<
+expectTypeOf<
EntryCollection
>(await client.withAllLocales.withoutLinkResolution.getEntries())
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.withoutLinkResolution.getEntries()).includes!.Entry![0],
)
-expectType>(
+expectTypeOf>(
(await client.withAllLocales.withoutLinkResolution.getEntries())
.includes!.Entry![0],
-)
+)})
\ No newline at end of file
diff --git a/test/types/client/parseEntries.test-d.ts b/test/types/client/parseEntries.test-d.ts
index 13df9051d..93ee3938e 100644
--- a/test/types/client/parseEntries.test-d.ts
+++ b/test/types/client/parseEntries.test-d.ts
@@ -1,4 +1,4 @@
-import { expectType } from 'tsd'
+import { expectTypeOf, test } from 'vitest'
import {
createClient,
EntryCollection,
@@ -103,55 +103,59 @@ const dataWithAllLocales: EntryCollection<
],
}
-expectType>(client.parseEntries(data))
-expectType>(client.parseEntries(data))
+test('parseEntries', async () => {
+ expectTypeOf>(client.parseEntries(data))
+ expectTypeOf>(client.parseEntries(data))
-expectType>(
- client.withoutUnresolvableLinks.parseEntries(data),
-)
-expectType>(
- client.withoutUnresolvableLinks.parseEntries(data),
-)
+ expectTypeOf>(
+ client.withoutUnresolvableLinks.parseEntries(data),
+ )
+ expectTypeOf>(
+ client.withoutUnresolvableLinks.parseEntries(data),
+ )
-expectType>(
- client.withoutLinkResolution.parseEntries(data),
-)
-expectType>(
- client.withoutLinkResolution.parseEntries(data),
-)
+ expectTypeOf