Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
fix: allow activating package in beforeAll
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Feb 7, 2020
1 parent 8a4143b commit 8726a17
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/spec-helper/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,18 @@ if (specDirectory = FindParentDir.sync(testPaths[0], "fixtures")) {
specProjectPath = path.join(specDirectory, "fixtures");
}

// resolve the package name to this package instead of the installed one
const resolvePackagePath = atom.packages.resolvePackagePath.bind(atom.packages);
atom.packages.resolvePackagePath = function (packageName) {
if (specPackageName && (packageName === specPackageName)) {
return resolvePackagePath(specPackagePath);
}
return resolvePackagePath(packageName);
};

beforeEach(function () {
// set project paths to the packages fixtures directory
if (specProjectPath) {
atom.project.setPaths([specProjectPath]);
}

// resolve the package name to this package instead of the installed one
const resolvePackagePath = atom.packages.resolvePackagePath.bind(atom.packages);
spyOn(atom.packages, "resolvePackagePath").and.callFake(function (packageName) {
if (specPackageName && (packageName === specPackageName)) {
return resolvePackagePath(specPackagePath);
}
return resolvePackagePath(packageName);

});
});

0 comments on commit 8726a17

Please sign in to comment.