Instead of copying and writing files on the fly for SEA tests, put the fixtures into a directory and copy them into tmpdir for testing. This allows easier reproduction and debugging when they do fail - we can just copy the entire fixture directory and test directly from there. PR-URL: https://github.com/nodejs/node/pull/61167 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
9 lines
327 B
JavaScript
9 lines
327 B
JavaScript
const sea = require('node:sea');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const addonPath = path.join(process.cwd(), 'hello.node');
|
|
fs.writeFileSync(addonPath, new Uint8Array(sea.getRawAsset('hello.node')));
|
|
const mod = {exports: {}};
|
|
process.dlopen(mod, addonPath);
|
|
console.log('hello,', mod.exports.hello());
|