Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ember-cli-blueprint-test-helpers
Advanced tools
Blueprint test helpers for ember-cli. Mocks ember-cli for generate and destroy commands.
test helpers for ember-cli blueprints
Install the helpers via npm:
npm install --save-dev ember-cli-blueprint-test-helpers
Run the following command to generate the test runner:
ember generate ember-cli-blueprint-test-helpers
If you are using ember-cli-blueprint-test-helpers
on Node v4.x or lower, you'll want to use the --babel
option, to add ES6 support.
ember generate ember-cli-blueprint-test-helpers --babel
It should be noted that ember-cli-blueprint-test-helpers
currently only works for testing blueprints inside addon projects.
The blueprint tests can be run by:
node_modules/.bin/mocha node-tests --recursive
For convenience you should add the following to your package.json
:
"scripts": {
"nodetest": "mocha node-tests --recursive"
}
to be able to use npm run nodetest
to run the tests.
Generate a blueprint test scaffold using the blueprint-test
generator:
ember generate blueprint-test my-blueprint
which will generate a test file at node-tests/blueprints/my-blueprint-test.js
.
describe('Acceptance: ember generate and destroy my-blueprint', function() {
// create and destroy temporary working directories
setupTestHooks(this);
it('my-blueprint foo', function() {
var args = ['my-blueprint', 'foo'];
// create a new Ember.js app in the working directory
return emberNew()
// then generate and destroy the `my-blueprint` blueprint called `foo`
.then(() => emberGenerateDestroy(args, (file) => {
// and run some assertions in between
expect(file('path/to/file.js'))
.to.contain('file contents to match')
.to.contain('more file contents\n');
}));
// magically done for you: assert that the generated files are destroyed again
});
});
or more explicitly:
describe('Acceptance: ember generate and destroy my-blueprint', function() {
// create and destroy temporary working directories
setupTestHooks(this);
it('my-blueprint foo', function() {
var args = ['my-blueprint', 'foo'];
// create a new Ember.js app in the working directory
return emberNew()
// then generate the `my-blueprint` blueprint called `foo`
.then(() => emberGenerate(args))
// then assert that the files were generated correctly
.then(() => expect(file('path/to/file.js'))
.to.contain('file contents to match')
.to.contain('more file contents\n'))
// then destroy the `my-blueprint` blueprint called `foo`
.then(() => emberDestroy(args))
// then assert that the files were destroyed correctly
.then(() => expect(file('path/to/file.js')).to.not.exist);
});
});
This project exports two major API endpoints for you to use:
require('ember-cli-blueprint-test-helpers/chai')
This endpoint exports the Chai assertion library including the chai-as-promised and chai-files plugins
require('ember-cli-blueprint-test-helpers/helpers')
This endpoint exports the functions mentioned in the following API reference
setupTestHooks(scope, options)
Prepare the test context for the blueprint tests.
Parameters:
{Object} scope
the test context (i.e. this
){Object} [options]
optional parameters{Number} [options.timeout=20000]
the test timeout in milliseconds{Object} [options.tmpenv]
object containing info about the temporary directory for the test.{String} [options.cliPath='ember-cli']
path to the ember-cli
dependency
Defaults to lib/helpers/tmp-env.js
Returns: {Promise}
emberNew(options)
Create a new Ember.js app or addon in the current working directory.
Parameters:
{Object} [options]
optional parameters{String} [options.target='app']
the type of project to create (app
, addon
or in-repo-addon
)Returns: {Promise}
emberGenerate(args)
Run a blueprint generator.
Parameters:
{Array.<String>} args
arguments to pass to ember generate
(e.g. ['my-blueprint', 'foo']
)Returns: {Promise}
emberDestroy(args)
Run a blueprint destructor.
Parameters:
{Array.<String>} args
arguments to pass to ember destroy
(e.g. ['my-blueprint', 'foo']
)Returns: {Promise}
emberGenerateDestroy(args, assertionCallback)
Run a blueprint generator and the corresponding blueprint destructor while checking assertions in between.
Parameters:
{Array.<String>} args
arguments to pass to ember generate
(e.g. ['my-blueprint', 'foo']
){Function} assertionCallback
the callback function in which the assertions should happenReturns: {Promise}
modifyPackages(packages)
Modify the dependencies in the package.json
file of the test project.
Parameters:
{Array.<Object>} packages
the list of packages that should be added,
changed or removedsetupPodConfig(options)
Setup usePods
in .ember-cli
and/or podModulePrefix
in environment.js
.
Parameters:
{Object} [options]
optional parameters{Boolean} [options.usePods]
add usePods
in .ember-cli
{Boolean} [options.podModulePrefix]
set npodModulePrefix
to app/pods
in config/environment.js
This project is licensed under the MIT License.
v0.13.1 (2016-11-22)
Closed issues:
Merged pull requests:
FAQs
Blueprint test helpers for ember-cli. Mocks ember-cli for generate and destroy commands.
The npm package ember-cli-blueprint-test-helpers receives a total of 1,328 weekly downloads. As such, ember-cli-blueprint-test-helpers popularity was classified as popular.
We found that ember-cli-blueprint-test-helpers demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.