Skip to content

Commit

Permalink
Add support for beta electron versions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallOfSound committed Dec 17, 2017
1 parent 051a62d commit 1c425dc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ const install = (extensionReference, forceDownload = false) => {
let chromeStoreID;
if (typeof extensionReference === 'object' && extensionReference.id) {
chromeStoreID = extensionReference.id;
if (!semver.satisfies(process.versions.electron, extensionReference.electron)) {
const electronVersion = process.versions.electron.split('-')[0];
if (!semver.satisfies(electronVersion, extensionReference.electron)) {
return Promise.reject(
new Error(`Version of Electron: ${process.versions.electron} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`), // eslint-disable-line
new Error(`Version of Electron: ${electronVersion} does not match required range ${extensionReference.electron} for extension ${chromeStoreID}`), // eslint-disable-line
);
}
} else if (typeof extensionReference === 'string') {
Expand Down
7 changes: 7 additions & 0 deletions test/compat_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ describe('Extension Compatability Checker', () => {
});
});

describe('when using a compatable beta version of electron', () => {
it('should resolve the promise', () => {
process.versions.electron = '1.8.2-beta.3';
return installExtension(REACT_DEVELOPER_TOOLS).should.be.fulfilled;
});
});

afterEach(() => {
process.versions.electron = currentVersion;
});
Expand Down

0 comments on commit 1c425dc

Please sign in to comment.