Skip to content

Instantly share code, notes, and snippets.

packages: ./dhall ./dhall-bash ./dhall-json ./dhall-lsp-server ./dhall-nix
keep-going: true
benchmarks: true
tests: true
allow-newer:
cborg-json:base
source-repository-package
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-lsp-server ./dhall-nix
keep-going: true
benchmarks: true
tests: true
allow-newer:
turtle:time,
cborg-json:base,
haskell-lsp:base,
packages: ./dhall ./dhall-bash ./dhall-json ./dhall-lsp-server ./dhall-nix
keep-going: true
-- bench:aeson -> criterion -> aeson dependency cycle forms because of https://github.com/haskell/cabal/issues/5586; easiest to just disable benchmarks for the time being
benchmarks: false
allow-newer:
turtle:time,
cborg-json:base,
aeson:template-haskell,
diff --git a/packages/core/parcel-bundler/src/assets/JSAsset.js b/packages/core/parcel-bundler/src/assets/JSAsset.js
index 8b1748ba..f12c8f97 100644
--- a/packages/core/parcel-bundler/src/assets/JSAsset.js
+++ b/packages/core/parcel-bundler/src/assets/JSAsset.js
@@ -188,13 +188,10 @@ class JSAsset extends Asset {
}
}
- return [
- {
import indexedDB from "fake-indexeddb";
import IDBKeyRange from 'fake-indexeddb/lib/FDBKeyRange';
import IDBIndex from 'fake-indexeddb/lib/FDBIndex';
import IDBCursor from 'fake-indexeddb/lib/FDBCursor';
import IDBDatabase from 'fake-indexeddb/lib/FDBDatabase';
import IDBTransaction from 'fake-indexeddb/lib/FDBTransaction';
import IDBObjectStore from 'fake-indexeddb/lib/FDBObjectStore';
import IDBRequest from 'fake-indexeddb/lib/FDBRequest';
global.indexedDB = indexedDB;
import indexedDB from "fake-indexeddb";
import IDBKeyRange from 'fake-indexeddb/lib/FDBKeyRange';
import IDBIndex from 'fake-indexeddb/lib/FDBIndex';
import IDBCursor from 'fake-indexeddb/lib/FDBCursor';
import IDBDatabase from 'fake-indexeddb/lib/FDBDatabase';
import IDBTransaction from 'fake-indexeddb/lib/FDBTransaction';
import IDBObjectStore from 'fake-indexeddb/lib/FDBObjectStore';
import IDBRequest from 'fake-indexeddb/lib/FDBRequest';
global.indexedDB = indexedDB;
// When should a new session identifier be generated? If it's done unconditionally, this can cause a double free when the extension reloads, as we think the extension pages' references are stale. If it's done in onStartup, then we mightn't clean up stale references as promptly as we could due to bug 1534700 (which is less bad, but annoying).
session = generateSessionIdentifier();
messaged = () => {
return Promise.resolve(session);
};
browser.runtime.onMessage.addListener(messaged);
for (const [referenceId, record] in db.store(REFERENCES).getAll()) {

Being able to flush promise resolution (or rejection) in tests is really, really handy, and even essential sometimes. Jest has an open issue for this but I'm impatient.

Setting this up in userland is possible but non-trivial - an adventure, even. I'll lay out what I had to do for any future intrepid types. I'll try to explain the reasoning for all of this and have nothing be magical.

The over-all target is to do task scheduling entirely in userland so that the task queue can be synchronously run to exhaustion. This entails faking timers and swapping out the native promise implementation for one that'll use the faked timers. All of this will be assuming you're using Jest, but the general ideas are test library agnostic.

Runtime performance seems near to native, though there's significantly more transpilation to be done - first runs will be much slower. If you're seeing significant slowdowns, something's probabl

v11.6.0
6.6.0
/home/quasicomputational/src/examples/nyc-merge-missing-parent
├─┬ [email protected]
│ ├── [email protected]
│ ├── [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected]
│ ├── [email protected]
│ ├── [email protected]
browser.browserAction.onClicked.addListener(() => {
browser.tabs.query({ active: true })
.then((tabs) => {
for (tab of tabs) {
browser.tabs.update(tab.id, { url: "/test.html" });
}
});
});