Files: 65191f9a9664f013ebe726bb95a1a54b086e1bd5 / test / test-50-symlink / main.js
771 bytesRaw
1 | |
2 | |
3 | 'use strict'; |
4 | |
5 | const fs = require('fs'); |
6 | const path = require('path'); |
7 | const assert = require('assert'); |
8 | const utils = require('../utils.js'); |
9 | |
10 | assert(!module.parent); |
11 | assert(__dirname === process.cwd()); |
12 | |
13 | // test symlinks on unix only // TODO junction |
14 | if (process.platform === 'win32') return; |
15 | |
16 | const target = process.argv[2] || 'host'; |
17 | const input = './test-x-index.js'; |
18 | const output = './test-output.exe'; |
19 | const symlink = './test-symlink.exe'; |
20 | |
21 | let right; |
22 | |
23 | utils.pkg.sync([ |
24 | '--target', target, |
25 | '--output', output, input |
26 | ]); |
27 | |
28 | fs.symlinkSync(output, symlink); |
29 | |
30 | right = utils.spawn.sync( |
31 | './' + path.basename(symlink), [], |
32 | { cwd: path.dirname(symlink) } |
33 | ); |
34 | |
35 | assert.equal(right, '42\n'); |
36 | utils.vacuum.sync(output); |
37 | utils.vacuum.sync(symlink); |
38 |
Built with git-ssb-web