This repository has been archived by the owner on Sep 28, 2018. It is now read-only.
Ensure user packages are separated from bundled packages #37
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e22dd13
Use atom.packages.getPackageDirPaths to check if the package is bundled
Ben3eeE 8cb8c4b
Remove path as a dependency
Ben3eeE 2992a39
Change andCallFake to andReturn
Ben3eeE 5cd0fe7
Remove the check for isBundledPackage after review
Ben3eeE 4d3426c
More review feedback
Ben3eeE File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,14 +161,18 @@ describe("Reporter", () => { | |
expect(error.privateMetadataDescription).toBeUndefined() | ||
expect(error.metadata).toEqual({foo: "bar"});});}) | ||
|
||
it("adds bundled and user packages to the error's metadata", () => { | ||
it('treats packages located in atom.packages.getPackageDirPaths as user packages', () => { | ||
mockActivePackages = [ | ||
{name: 'user-1', path: '/Users/user/.atom/packages/user-1', metadata: {version: '1.0.0'}}, | ||
{name: 'user-2', path: '/Users/user/.atom/packages/user-2', metadata: {version: '1.2.0'}}, | ||
{name: 'bundled-1', path: '/Applications/Atom.app/Contents/Resources/app.asar/node_modules/bundled-1', metadata: {version: '1.0.0'}}, | ||
{name: 'bundled-2', path: '/Applications/Atom.app/Contents/Resources/app.asar/node_modules/bundled-2', metadata: {version: '1.2.0'}}, | ||
] | ||
|
||
const packageDirPaths = ['/Users/user/.atom/packages'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be worth it in a follow-up PR to convert all of these hardcoded paths to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 I can do that |
||
|
||
spyOn(atom.packages, 'getPackageDirPaths').andReturn(packageDirPaths) | ||
|
||
let error = new Error() | ||
Error.captureStackTrace(error) | ||
reporter.reportUncaughtException(error) | ||
|
@@ -360,14 +364,18 @@ describe("Reporter", () => { | |
}) | ||
}) | ||
|
||
it("adds bundled and user packages to the error's metadata", () => { | ||
it('treats packages located in atom.packages.getPackageDirPaths as user packages', () => { | ||
mockActivePackages = [ | ||
{name: 'user-1', path: '/Users/user/.atom/packages/user-1', metadata: {version: '1.0.0'}}, | ||
{name: 'user-2', path: '/Users/user/.atom/packages/user-2', metadata: {version: '1.2.0'}}, | ||
{name: 'bundled-1', path: '/Applications/Atom.app/Contents/Resources/app.asar/node_modules/bundled-1', metadata: {version: '1.0.0'}}, | ||
{name: 'bundled-2', path: '/Applications/Atom.app/Contents/Resources/app.asar/node_modules/bundled-2', metadata: {version: '1.2.0'}}, | ||
] | ||
|
||
const packageDirPaths = ['/Users/user/.atom/packages'] | ||
|
||
spyOn(atom.packages, 'getPackageDirPaths').andReturn(packageDirPaths) | ||
|
||
let error = new Error() | ||
Error.captureStackTrace(error) | ||
reporter.reportFailedAssertion(error) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid negation you could just flip the if statements around :).