Skip to content

Commit

Permalink
Merge pull request #307 from marp-team/edge-fallback-for-linux
Browse files Browse the repository at this point in the history
Add fallback to Microsoft Edge for Linux
  • Loading branch information
yhatt authored Nov 28, 2020
2 parents 319ac28 + 86a62e2 commit d30e7bd
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Added

- Support for fallback into Microsoft Edge in Linux ([#296](https://github.com/marp-team/marp-cli/issues/296), [#307](https://github.com/marp-team/marp-cli/pull/307))

### Fixed

- Compatibility with Apple Silicon ([#301](https://github.com/marp-team/marp-cli/issues/301), [#305](https://github.com/marp-team/marp-cli/pull/305))
Expand Down
9 changes: 6 additions & 3 deletions src/utils/edge-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ const linux = (): string | undefined => {
})
}

// TODO: Find out Microsoft Edge for Linux
// https://www.microsoftedgeinsider.com/en-us/download?platform=linux
return undefined
return findAccessiblePath([
'/opt/microsoft/msedge-canary/msedge',
'/opt/microsoft/msedge-dev/msedge',
'/opt/microsoft/msedge-beta/msedge',
'/opt/microsoft/msedge/msedge',
])
}

const darwin = (): string | undefined =>
Expand Down
18 changes: 16 additions & 2 deletions test/utils/edge-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,22 @@ describe('#findEdgeInstallation', () => {
Object.defineProperty(process, 'platform', { value: 'linux' })
})

it('returns undefined', () => {
expect(edgeFinder.findEdgeInstallation()).toBeUndefined()
it('finds out the first accessible Edge from specific paths', () => {
const findAccessiblePath = jest
.spyOn(edgeFinder, 'findAccessiblePath')
.mockImplementation(() => '/opt/microsoft/msedge/msedge')

expect(edgeFinder.findEdgeInstallation()).toBe(
'/opt/microsoft/msedge/msedge'
)
expect(findAccessiblePath.mock.calls[0][0]).toMatchInlineSnapshot(`
Array [
"/opt/microsoft/msedge-canary/msedge",
"/opt/microsoft/msedge-dev/msedge",
"/opt/microsoft/msedge-beta/msedge",
"/opt/microsoft/msedge/msedge",
]
`)
})

describe('on Windows WSL', () => {
Expand Down

0 comments on commit d30e7bd

Please sign in to comment.