VulpesOS/gaia/shared/test/integration/require_from_app.js
OverSu b38dea0597 Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
2026-09-30 23:13:03 +02:00

32 lines
598 B
JavaScript
Executable file

'use strict';
/* global module */
var appRoot = require('app-root-path');
// TODO Export this helper in its own npm package
function FromApp(app) {
this.app = app;
return this;
}
FromApp.prototype = {
filePath: function(relativePath) {
var app = this.app;
if (['dialer', 'contacts'].indexOf(app) !== -1) {
app = 'communications/' + app;
}
return appRoot + '/apps/' + app + '/test/marionette/' + relativePath;
},
require: function(resource) {
return require(this.filePath(resource));
}
};
module.exports = function(app) {
return new FromApp(app);
};