Closed
Description
v3.16.6
import assert from 'assert';
import 'quibble';
import {LighthouseError} from '../lib/lh-error.js';
assert( (await import('../lib/lh-error.js')).LighthouseError === LighthouseError );
You can replace line 3 with an import for any object - doesn't matter what, although doesn't seem to happen for builtins (ie. fs
readFileSync equality won't be broken)
The above assertion fails only when using the testdouble
loader. Seems to happen in all supported versions on Node.
This error manifests commonly when tests rely on object equality, instanceof
or Symbols. If you set a breakpoint inside the module being loaded (in this example, lh-error.js) you'll see that the module is evaluated twice, once when the static import block for the test file runs, and once again when the dynamic import runs.
Metadata
Metadata
Assignees
Labels
No labels