Created
December 22, 2016 09:10
-
-
Save kozo002/7e080bc48a95ba18db37cc91baa54f64 to your computer and use it in GitHub Desktop.
for jest on Rails
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
module.exports = { | |
_path(basePath, filePath) { | |
let splitDir = __dirname.split("/"); | |
splitDir.shift(); | |
let appRootIndex; | |
splitDir.map((dir, i) => { | |
if (dir === "spec") { | |
appRootIndex = i; | |
} | |
}); | |
splitDir.splice(appRootIndex, splitDir.length - appRootIndex); | |
splitDir = splitDir.concat(basePath.split("/")) | |
splitDir = splitDir.concat(filePath.split("/")) | |
return "/" + splitDir.join("/"); | |
}, | |
appPath(filePath) { | |
return this._path("app/assets/javascripts", filePath); | |
}, | |
supportPath(filePath) { | |
return this._path("spec/support/javascript", filePath); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment