Skip to content

Commit

Permalink
fix: __mockImport should provide document context
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Jun 22, 2021
1 parent 289e877 commit 9b7f2e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/import/qImport.ts
Expand Up @@ -9,7 +9,7 @@
import type { QRL } from './qrl.js';
import { QError, qError } from '../error/error.js';

declare const __mockImport: (path: string) => Promise<any>;
declare const __mockImport: (path: string, doc: Document) => Promise<any>;

/**
* Lazy load a `QRL` symbol and returns the resulting value.
Expand All @@ -35,7 +35,7 @@ export function qImport<T>(node: Node | Document, url: string | QRL<T> | URL): T
// TODO(misko): Concern: When in `cjs` mode we should be using require?
const promise = (
typeof __mockImport === 'function'
? __mockImport(importPath + '.js')
? __mockImport(importPath + '.js', doc)
: import(importPath + '.js')
).then((module) => {
const handler = module[exportName];
Expand Down

0 comments on commit 9b7f2e3

Please sign in to comment.