ember-source
Version:
A JavaScript framework for creating ambitious web applications
46 lines (35 loc) • 1.31 kB
JavaScript
const fs = require('fs');
const path = require('path');
const pathUtil = require('ember-cli-path-utils');
const stringUtils = require('ember-cli-string-utils');
const typescriptBlueprintPolyfill = require('ember-cli-typescript-blueprint-polyfill');
const { modulePrefixForProject } = require('../-utils');
const useTestFrameworkDetector = require('../test-framework-detector');
module.exports = useTestFrameworkDetector({
description: 'Generates an acceptance test for a feature.',
shouldTransformTypeScript: true,
init() {
this._super && this._super.init.apply(this, arguments);
typescriptBlueprintPolyfill(this);
},
locals: function (options) {
let testFolderRoot = stringUtils.dasherize(options.project.name());
if (options.project.isEmberCLIAddon()) {
testFolderRoot = pathUtil.getRelativeParentPath(options.entity.name, -1, false);
}
let destroyAppExists = fs.existsSync(
path.join(this.project.root, '/tests/helpers/destroy-app.js')
);
let friendlyTestName = [
'Acceptance',
stringUtils.dasherize(options.entity.name).replace(/[-]/g, ' '),
].join(' | ');
return {
modulePrefix: modulePrefixForProject(options.project),
testFolderRoot,
friendlyTestName,
destroyAppExists,
};
},
});
;