mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Delete MeteorDynamicImportCache database before running tests.
Also run the tests a third time without deleting the database, to exercise the caching logic.
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
import assert from "assert";
|
||||
|
||||
describe("dynamic import(...)", function () {
|
||||
if (global.indexedDB) {
|
||||
const saveCache = process.env.METEOR_SAVE_DYNAMIC_IMPORT_CACHE;
|
||||
if (! (saveCache && JSON.parse(saveCache))) {
|
||||
it("cleared the IndexedDB cache", function () {
|
||||
return new Promise((resolve, reject) => {
|
||||
const deleteRequest =
|
||||
global.indexedDB.deleteDatabase("MeteorDynamicImportCache");
|
||||
deleteRequest.onerror =
|
||||
deleteRequest.onblocked =
|
||||
deleteRequest.onsuccess = resolve;
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
it("import same module both statically and dynamically", function () {
|
||||
import moment from "moment";
|
||||
return import("./imports/date").then(date => {
|
||||
|
||||
@@ -13,6 +13,13 @@ selftest.define("dynamic import(...) in production", function () {
|
||||
s.cd("dynamic-import-test-app-prod", run.bind(s, true));
|
||||
});
|
||||
|
||||
selftest.define("dynamic import(...) with cache", function () {
|
||||
const s = new Sandbox();
|
||||
s.createApp("dynamic-import-test-app-cache", "dynamic-import");
|
||||
s.set("METEOR_SAVE_DYNAMIC_IMPORT_CACHE", "true");
|
||||
s.cd("dynamic-import-test-app-cache", run.bind(s, true));
|
||||
});
|
||||
|
||||
function run(isProduction) {
|
||||
const sandbox = this;
|
||||
const args = [
|
||||
|
||||
Reference in New Issue
Block a user