This repository has been archived by the owner on Jul 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(launcher): add beforeTest and afterTest
- Loading branch information
Showing
8 changed files
with
133 additions
and
103 deletions.
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
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
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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
var q = require('q'), | ||
path = require('path'); | ||
|
||
/** | ||
* Internal helper for abstraction of polymorphic filenameOrFn properties. | ||
* @param {object} filenameOrFn The filename or function that we will execute. | ||
* @param {Array.<object>}} args The args to pass into filenameOrFn. | ||
* @return {q.Promise} A promise that will resolve when filenameOrFn completes. | ||
*/ | ||
exports.runFilenameOrFn_ = function(configDir, filenameOrFn, args) { | ||
var returned; | ||
if (filenameOrFn) { | ||
if (typeof filenameOrFn === 'function') { | ||
returned = filenameOrFn.apply(null, args); | ||
} else if (typeof filenameOrFn === 'string') { | ||
filenameOrFn = require(path.resolve(configDir, filenameOrFn)); | ||
if (typeof filenameOrFn === 'function') { | ||
returned = filenameOrFn.apply(null, args); | ||
} | ||
} else { | ||
throw 'filenameOrFn must be a string or function'; | ||
} | ||
} | ||
return q.when(returned); | ||
}; |