Files: 67c0e15a98a66eb99db2251478505d6f3d37535c / test / test-50-api / main.js
798 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const path = require('path'); |
6 | const assert = require('assert'); |
7 | const utils = require('../utils.js'); |
8 | |
9 | assert(!module.parent); |
10 | assert(__dirname === process.cwd()); |
11 | |
12 | const target = process.argv[2] || 'host'; |
13 | const input = './test-x-index.js'; |
14 | const output = './test-output.exe'; |
15 | |
16 | let right; |
17 | utils.mkdirp.sync(path.dirname(output)); |
18 | |
19 | // calling twice |
20 | require('../../').exec([ |
21 | '--target', target, |
22 | '--output', output, input |
23 | ]).then(function () { |
24 | return require('../../').exec([ |
25 | '--target', target, |
26 | '--output', output, input |
27 | ]).then(function () { |
28 | right = utils.spawn.sync( |
29 | output, [], {} |
30 | ); |
31 | |
32 | assert.equal(right, '42\n'); |
33 | utils.vacuum.sync(output); |
34 | }); |
35 | }).catch(function (error) { |
36 | console.error(error); |
37 | process.exit(2); |
38 | }); |
39 |
Built with git-ssb-web