mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 02:42:08 +00:00

PR-URL: https://github.com/nodejs/node/pull/47125 Refs: https://github.com/nodejs/single-executable/discussions/58 Reviewed-By: Darshan Sen <raisinten@gmail.com>
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
// This tests valid options for --experimental-sea-config.
|
|
'use strict';
|
|
|
|
require('../common');
|
|
const tmpdir = require('../common/tmpdir');
|
|
const { writeFileSync, existsSync } = require('fs');
|
|
const { spawnSync } = require('child_process');
|
|
const assert = require('assert');
|
|
const { join } = require('path');
|
|
|
|
{
|
|
tmpdir.refresh();
|
|
const config = join(tmpdir.path, 'absolute.json');
|
|
const main = join(tmpdir.path, 'bundle.js');
|
|
const output = join(tmpdir.path, 'output.blob');
|
|
writeFileSync(main, 'console.log("hello")', 'utf-8');
|
|
const configJson = JSON.stringify({
|
|
main,
|
|
output,
|
|
});
|
|
writeFileSync(config, configJson, 'utf8');
|
|
const child = spawnSync(
|
|
process.execPath,
|
|
['--experimental-sea-config', config], {
|
|
cwd: tmpdir.path,
|
|
});
|
|
assert.strictEqual(child.status, 0);
|
|
assert(existsSync(output));
|
|
}
|
|
|
|
{
|
|
tmpdir.refresh();
|
|
const config = join(tmpdir.path, 'relative.json');
|
|
const main = join(tmpdir.path, 'bundle.js');
|
|
const output = join(tmpdir.path, 'output.blob');
|
|
writeFileSync(main, 'console.log("hello")', 'utf-8');
|
|
const configJson = JSON.stringify({
|
|
main: 'bundle.js',
|
|
output: 'output.blob'
|
|
});
|
|
writeFileSync(config, configJson, 'utf8');
|
|
const child = spawnSync(
|
|
process.execPath,
|
|
['--experimental-sea-config', config], {
|
|
cwd: tmpdir.path,
|
|
});
|
|
|
|
assert.strictEqual(child.status, 0);
|
|
assert(existsSync(output));
|
|
}
|