git ssb

0+

cel-desktop / ssb-pkg



Tree: ca90b5ca0579ebdcc0635288bce4978e3fb200f5

Files: ca90b5ca0579ebdcc0635288bce4978e3fb200f5 / test / test-50-native-addon / main.js

907 bytesRaw
1#!/usr/bin/env node
2
3'use strict';
4
5const fs = require('fs');
6const path = require('path');
7const assert = require('assert');
8const utils = require('../utils.js');
9
10assert(!module.parent);
11assert(__dirname === process.cwd());
12
13const host = 'node' + process.version.match(/^v(\d+)/)[1];
14const target = process.argv[2] || host;
15const input = './test-x-index.js';
16const output = './run-time/test-output.exe';
17
18let left, right;
19utils.mkdirp.sync(path.dirname(output));
20
21fs.writeFileSync(
22 path.join(path.dirname(output), 'time.node'),
23 fs.readFileSync('./lib/time.node')
24);
25
26left = utils.spawn.sync(
27 'node', [ path.basename(input) ],
28 { cwd: path.dirname(input) }
29);
30
31utils.pkg.sync([
32 '--target', target,
33 '--output', output, input
34]);
35
36right = utils.spawn.sync(
37 './' + path.basename(output), [],
38 { cwd: path.dirname(output) }
39);
40
41assert.equal(left, right);
42utils.vacuum.sync(path.dirname(output));
43

Built with git-ssb-web