diff --git a/cli/package.json b/cli/package.json index e0e7f4456..66b3ba724 100644 --- a/cli/package.json +++ b/cli/package.json @@ -56,7 +56,7 @@ "open": "^8.4.0", "plist": "^3.0.5", "prompts": "^2.4.2", - "rimraf": "^3.0.2", + "rimraf": "^4.4.1", "semver": "^7.3.7", "tar": "^6.1.11", "tslib": "^2.4.0", @@ -64,21 +64,23 @@ }, "devDependencies": { "@types/debug": "^4.1.7", - "@types/jest": "^26.0.4", + "@types/jest": "^29.5.0", "@types/plist": "^3.0.2", "@types/prompts": "^2.0.14", - "@types/rimraf": "^3.0.2", "@types/semver": "^7.3.10", "@types/tar": "^6.1.1", "@types/tmp": "^0.2.3", "@types/xml2js": "0.4.5", - "jest": "^26.1.0", + "jest-environment-jsdom": "^29.5.0", + "jest-jasmine2": "^29.5.0", + "jest": "^29.5.0", "tmp": "^0.2.1", - "ts-jest": "^26.1.3", - "typescript": "~4.9.5" + "ts-jest": "^29.0.5", + "typescript": "~5.0.2" }, "jest": { - "preset": "ts-jest" + "preset": "ts-jest", + "testRunner": "jest-jasmine2" }, "publishConfig": { "access": "public" diff --git a/core/package.json b/core/package.json index 55a66bdd6..089190a61 100644 --- a/core/package.json +++ b/core/package.json @@ -38,15 +38,18 @@ "devDependencies": { "@rollup/plugin-node-resolve": "^10.0.0", "@rollup/plugin-replace": "^2.4.2", - "@types/jest": "^26.0.4", - "jest": "^26.1.0", - "rimraf": "^3.0.2", + "@types/jest": "^29.5.0", + "jest-environment-jsdom": "^29.5.0", + "jest-jasmine2": "^29.5.0", + "jest": "^29.5.0", + "rimraf": "^4.4.1", "rollup": "^2.21.0", "rollup-plugin-terser": "^7.0.2", - "typescript": "^4.0.5" + "typescript": "~5.0.2" }, "jest": { - "preset": "ts-jest" + "preset": "ts-jest", + "testRunner": "jest-jasmine2" }, "publishConfig": { "access": "public" diff --git a/core/src/tests/bridge.spec.ts b/core/src/tests/bridge.spec.ts index 3e4c13a3a..5e05abda2 100644 --- a/core/src/tests/bridge.spec.ts +++ b/core/src/tests/bridge.spec.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import { initBridge } from '../../native-bridge'; import type { CapacitorInstance, @@ -13,6 +17,10 @@ describe('bridge', () => { beforeEach(() => { win = {}; initBridge(win); + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-empty-function + window.prompt = () => {}; }); it('android nativePromise error', done => { diff --git a/core/src/tests/legacy.spec.ts b/core/src/tests/legacy.spec.ts index 7551a0cc5..a9902a853 100644 --- a/core/src/tests/legacy.spec.ts +++ b/core/src/tests/legacy.spec.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import { initBridge } from '../../native-bridge'; import type { CapacitorGlobal } from '../definitions'; import type { WindowCapacitor } from '../definitions-internal'; diff --git a/core/src/tests/plugin.spec.ts b/core/src/tests/plugin.spec.ts index f120874be..9c0164451 100644 --- a/core/src/tests/plugin.spec.ts +++ b/core/src/tests/plugin.spec.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import { initBridge } from '../../native-bridge'; import type { CapacitorGlobal, Plugin } from '../definitions'; import type { @@ -14,6 +18,9 @@ describe('plugin', () => { beforeEach(() => { win = {}; + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore + global.setImmediate = global.setTimeout; }); it('error from missing method from native implementation', async done => { diff --git a/core/src/tests/web-plugin.spec.ts b/core/src/tests/web-plugin.spec.ts index 3bfb4e246..d95a5eb20 100644 --- a/core/src/tests/web-plugin.spec.ts +++ b/core/src/tests/web-plugin.spec.ts @@ -1,3 +1,7 @@ +/** + * @jest-environment jsdom + */ + import { initBridge } from '../../native-bridge'; import type { WindowCapacitor } from '../definitions-internal'; import { createCapacitor } from '../runtime'; diff --git a/package.json b/package.json index a45334e2c..990d43d45 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "prettier": "~2.3.0", "prettier-plugin-java": "~1.1.1", "swiftlint": "^1.0.1", - "tar": "^6.1.11" + "tar": "^6.1.11", + "rimraf": "^4.4.1" } }