import-in-the-middle
Version:
Intercept imports in Node.js
11 lines (8 loc) • 373 B
JavaScript
import { strictEqual } from 'assert'
// We dynamically import a specific file that imports the
// native module for this platform and architecture.
//
// This way we know the file exists and the native module can
// be loaded.
const lib = await import(`../fixtures/native-modules/${process.platform}-${process.arch}.js`)
strictEqual(typeof lib.default.crc32, 'function')