Skip to content

Commit

Permalink
fix: travis
Browse files Browse the repository at this point in the history
Travis-CI uses Linux virtual machines, so we should use Linux-style file paths.
I fixed the problem with cross-platform file paths using node module "path".
  • Loading branch information
dizel3d committed Mar 14, 2016
2 parents 53c37d0 + 68c0920 commit cd66ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// Dependencies
// ------------

var path = require('path')
var fs = require('fs')
var urlparse = require('url').parse
var urlformat = require('url').format
Expand All @@ -17,13 +18,13 @@ var PROCESS_NAME = 'iexplore.exe'

// Find the ie executable
function getInternetExplorerExe () {
var suffix = '\\Internet Explorer\\' + PROCESS_NAME
var suffix = path.join('Internet Explorer', PROCESS_NAME)
var locations = _.map(_.compact([
process.env['PROGRAMW6432'],
process.env['PROGRAMFILES(X86)'],
process.env['PROGRAMFILES']
]), function (prefix) {
return prefix + suffix
return path.join(prefix, suffix)
})

return _.find(locations, function (location) {
Expand Down
18 changes: 9 additions & 9 deletions test/launcher.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ describe('launcher', function () {
var fsMock, win32Location

beforeEach(function () {
process.env['PROGRAMW6432'] = '\\fake\\PROGRAMW6432'
process.env['PROGRAMFILES(X86)'] = '\\fake\\PROGRAMFILES(X86)'
process.env['PROGRAMFILES'] = '\\fake\\PROGRAMFILES'
process.env['PROGRAMW6432'] = path.normalize('/fake/PROGRAMW6432')
process.env['PROGRAMFILES(X86)'] = path.normalize('/fake/PROGRAMFILES(X86)')
process.env['PROGRAMFILES'] = path.normalize('/fake/PROGRAMFILES')
fsMock = mocks.fs.create({
'folder1': {
'Internet Explorer': {
Expand All @@ -124,20 +124,20 @@ describe('launcher', function () {
})

it('should locate in PROGRAMW6432', function (done) {
process.env['' + 'PROGRAMW6432'] = '\\folder1'
expect(win32Location()).to.equal('\\folder1\\Internet Explorer\\iexplore.exe')
process.env['' + 'PROGRAMW6432'] = path.normalize('/folder1')
expect(win32Location()).to.equal(path.normalize('/folder1/Internet Explorer/iexplore.exe'))
done()
})

it('should locate in PROGRAMFILES(X86)', function (done) {
process.env['' + 'PROGRAMFILES(X86)'] = '\\folder1'
expect(win32Location()).to.equal('\\folder1\\Internet Explorer\\iexplore.exe')
process.env['' + 'PROGRAMFILES(X86)'] = path.normalize('/folder1')
expect(win32Location()).to.equal(path.normalize('/folder1/Internet Explorer/iexplore.exe'))
done()
})

it('should locate in PROGRAMFILES', function (done) {
process.env['' + 'PROGRAMFILES'] = '\\folder1'
expect(win32Location()).to.equal('\\folder1\\Internet Explorer\\iexplore.exe')
process.env['' + 'PROGRAMFILES'] = path.normalize('/folder1')
expect(win32Location()).to.equal(path.normalize('/folder1/Internet Explorer/iexplore.exe'))
done()
})

Expand Down

0 comments on commit cd66ee2

Please sign in to comment.