|
| 1 | +var helpers = require('./global-setup') |
| 2 | +var path = require('path') |
| 3 | +var temp = require('temp').track() |
| 4 | + |
| 5 | +var describe = global.describe |
| 6 | +var it = global.it |
| 7 | +var beforeEach = global.beforeEach |
| 8 | +var afterEach = global.afterEach |
| 9 | +var expect = require('chai').expect |
| 10 | + |
| 11 | +describe('application loading', function () { |
| 12 | + helpers.setupTimeout(this) |
| 13 | + |
| 14 | + var app = null |
| 15 | + var tempPath = null |
| 16 | + |
| 17 | + beforeEach(function () { |
| 18 | + tempPath = temp.mkdirSync('spectron-temp-dir-') |
| 19 | + |
| 20 | + return helpers.startApplication({ |
| 21 | + cwd: path.join(__dirname, 'fixtures'), |
| 22 | + args: [ |
| 23 | + path.join(__dirname, 'fixtures', 'app'), |
| 24 | + '--bar1=baz1', |
| 25 | + '--bar2=baz2', |
| 26 | + '--bar3=baz3', |
| 27 | + '--bar4=baz4', |
| 28 | + '--bar5=baz5', |
| 29 | + '--bar6=baz6', |
| 30 | + '--bar7=baz7', |
| 31 | + '--bar8=baz8', |
| 32 | + '--bar9=baz9', |
| 33 | + '--bar10=baz10', |
| 34 | + '--bar11=baz11', |
| 35 | + '--bar12=baz12', |
| 36 | + '--bar13=baz13' |
| 37 | + ], |
| 38 | + env: { |
| 39 | + FOO: 'BAR', |
| 40 | + HELLO: 'WORLD', |
| 41 | + SPECTRON_TEMP_DIR: tempPath |
| 42 | + } |
| 43 | + }).then(function (startedApp) { app = startedApp }) |
| 44 | + }) |
| 45 | + |
| 46 | + afterEach(function () { |
| 47 | + return helpers.stopApplication(app) |
| 48 | + }) |
| 49 | + |
| 50 | + it('passes through args to the launched app', function () { |
| 51 | + return app.mainProcess.argv().then(function (argv) { |
| 52 | + expect(argv[2]).to.equal('--bar1=baz1') |
| 53 | + expect(argv[9]).to.equal('--bar8=baz8') |
| 54 | + expect(argv[12]).to.equal('--bar11=baz11') |
| 55 | + }) |
| 56 | + }) |
| 57 | +}) |
0 commit comments