The data contained in this repository can be downloaded to your computer using one of several clients.
Please see the documentation of your version control software client for more information.

Please select the desired protocol below to get the URL.

This URL has Read-Only access.

Statistics
| Branch: | Revision:

main_repo / deps / npm / node_modules / cmd-shim / test / 00-setup.js @ d46ebffb

History | View | Annotate | Download (895 Bytes)

1
var test = require('tap').test
2
var mkdirp = require('mkdirp')
3
var fs = require('fs')
4
var path = require('path')
5
var fixtures = path.resolve(__dirname, 'fixtures')
6

    
7
var froms = {
8
  'from.exe': 'exe',
9
  'from.env': '#!/usr/bin/env node\nconsole.log(/hi/)\n',
10
  'from.env.args': '#!/usr/bin/env node --expose_gc\ngc()\n',
11
  'from.sh': '#!/usr/bin/sh\necho hi\n',
12
  'from.sh.args': '#!/usr/bin/sh -x\necho hi\n'
13
}
14

    
15
var cmdShim = require('../')
16

    
17
test('create fixture', function (t) {
18
  mkdirp(fixtures, function (er) {
19
    if (er)
20
      throw er
21
    t.pass('made dir')
22
    Object.keys(froms).forEach(function (f) {
23
      t.test('write ' + f, function (t) {
24
        fs.writeFile(path.resolve(fixtures, f), froms[f], function (er) {
25
          if (er)
26
            throw er
27
          t.pass('wrote ' + f)
28
          t.end()
29
        })
30
      })
31
    })
32
    t.end()
33
  })
34
})