Skip to content

Commit

Permalink
upgrade to deno2, fixes #6739 (#6742)
Browse files Browse the repository at this point in the history
* upgrade to deno2, fixes #6739

* upgrade to deno2, fixes #6739

* upgrade to deno2, fixes #6739
  • Loading branch information
jkinggg authored Jan 8, 2025
1 parent bcb4dd4 commit ed9f346
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ jobs:
- uses: denoland/setup-deno@v1
with:
# https://github.com/denoland/deno/releases
deno-version: "1.46.3"
deno-version: "2.0.6"
- name: run deno tests:dexie
run: |
sudo npm i -g cross-env
Expand Down
6 changes: 6 additions & 0 deletions config/deno-import-map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"node:assert": "node:assert",
"assert": "node:assert"
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,10 @@
"test:node:memory-random-delay": "npm run transpile && cross-env DEFAULT_STORAGE=memory-random-delay mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js",
"test:node:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js",
"test:bun:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie NODE_ENV=fast bun run ./node_modules/mocha/bin/mocha test_tmp/unit.test.js --bail",
"test:deno:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie deno run --unstable --allow-env --unstable-byonm --allow-read -A npm:mocha ./test/unit.test.ts --bail",
"test:deno:denokv": "npm run transpile && cross-env DEFAULT_STORAGE=denokv deno run --unstable-kv --unstable-broadcast-channel --allow-env --unstable-byonm --allow-read -A npm:mocha ./test/unit.test.ts --bail --timeout 15000",
"test:deno:dexie": "npm run transpile && cross-env DEFAULT_STORAGE=dexie deno run --unstable --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail",
"test:deno:denokv": "npm run transpile && cross-env DEFAULT_STORAGE=denokv deno run --unstable-kv --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail --timeout 150000",
"test:deno:denokv:loop": "npm run test:deno:denokv && npm run test:deno:denokv:loop",
"test:deno:memory": "npm run transpile && cross-env DEFAULT_STORAGE=memory deno run --unstable --allow-env --unstable-byonm --allow-read -A npm:mocha ./test/unit.test.ts --bail",
"test:deno:memory": "npm run transpile && cross-env DEFAULT_STORAGE=memory deno run --unstable --unstable-broadcast-channel --unstable-byonm --import-map=config/deno-import-map.json -A npm:mocha ./test/unit.test.ts --bail",
"test:node:foundationdb": "npm run transpile && cross-env DEFAULT_STORAGE=foundationdb mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js",
"test:node:mongodb": "npm run transpile && cross-env DEFAULT_STORAGE=mongodb mocha --expose-gc --config ./config/.mocharc.cjs ./test_tmp/unit.test.js",
"test:node:mongodb:loop": "npm run test:node:mongodb && npm run test:node:mongodb:loop",
Expand Down
3 changes: 2 additions & 1 deletion src/plugins/storage-denokv/rx-storage-instance-denokv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ export class RxStorageInstanceDenoKV<RxDocType> implements RxStorageInstance<
} catch (err: any) {
if (
err.message.includes('Error code 5:') ||
err.message.includes('Error code 517:')
err.message.includes('Error code 517:') ||
err.message.includes('database is locked')
) {
// retry
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/test-utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type TestConfig = {
storage: RxTestStorage;
};

export const isDeno = typeof window !== 'undefined' && 'Deno' in window;
export const isDeno = typeof Deno !== 'undefined' || (typeof window !== 'undefined' && 'Deno' in window);
export const isBun = typeof process !== 'undefined' && !!process.versions.bun;
export const isNode = !isDeno && !isBun && typeof window === 'undefined';

Expand Down

0 comments on commit ed9f346

Please sign in to comment.