Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-blueprint-test-helpers

Package Overview
Dependencies
Maintainers
6
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-blueprint-test-helpers - npm Package Compare versions

Comparing version 0.18.3 to 0.19.0

lib/helpers/cleanup-env.js

2

blueprints/blueprint-test/files/__root__/__name__-test.js

@@ -17,3 +17,3 @@ 'use strict';

// pass any additional command line options in the arguments array
return emberNew()
return emberNew(<%= muOption %>)
.then(() => emberGenerateDestroy(args, (file) => {

@@ -20,0 +20,0 @@ // expect(file('app/type/foo.js')).to.contain('foo');

@@ -0,1 +1,3 @@

'use strict';
module.exports = {

@@ -10,11 +12,14 @@ fileMapTokens() {

}
};
}
},
locals(options) {
return {
blueprintName: options.entity.name
};
const blueprintName = options.entity.name;
const muOption =
(options.project.isModuleUnification())
? '{ isModuleUnification: true }'
: null;
return { blueprintName, muOption };
}
};
}
# Change Log
## v0.19.0 (2018-09-22)
#### :boom: Breaking Change
* [#155](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/155) Increase required minimum Node version to v6 ([@dcyriller](https://github.com/dcyriller))
#### :rocket: Enhancement
* [#153](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/153) Add MU support to blueprints test helpers ([@dcyriller](https://github.com/dcyriller))
#### :memo: Documentation
* [#165](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/165) package.json: Declare minimum Node versions ([@Turbo87](https://github.com/Turbo87))
* [#157](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/157) Fix typo in README ([@dcyriller](https://github.com/dcyriller))
#### :house: Internal
* [#159](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/159) Use ember-cli v3.5.0-beta.1 ([@dcyriller](https://github.com/dcyriller))
#### Committers: 2
- Cyrille David ([@dcyriller](https://github.com/dcyriller))
- Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
## v0.18.3 (2017-10-16)
#### :rocket: Enhancement
* [#132](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/132) update mocha to 4 ([@kellyselden](https://github.com/kellyselden))
#### Committers: 1
- Kelly Selden ([@kellyselden](https://github.com/kellyselden))
## v0.18.2 (2017-10-14)
#### :house: Internal
* [#142](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/142) apply code style of node 4+ ([@mbeatrizmagalhaes](https://github.com/mbeatrizmagalhaes))
* [#135](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/135) remove exists-sync ([@kellyselden](https://github.com/kellyselden))
* [#136](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/136) remove findup ([@kellyselden](https://github.com/kellyselden))
* [#137](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/137) remove lodash.merge ([@kellyselden](https://github.com/kellyselden))
* [#140](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/140) remove rimraf ([@kellyselden](https://github.com/kellyselden))
#### Committers: 2
- Beatriz Magalhães ([@mbeatrizmagalhaes](https://github.com/mbeatrizmagalhaes))
- Kelly Selden ([@kellyselden](https://github.com/kellyselden))
## v0.18.1 (2017-10-13)
#### :bug: Bug Fix
* [#124](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/124) Add missing "testdouble" dependency ([@Turbo87](https://github.com/Turbo87))
#### :house: Internal
* [#125](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/pull/125) Use ~ constraint for "ember-cli" ([@Turbo87](https://github.com/Turbo87))
#### Committers: 1
- Tobias Bieniek ([@Turbo87](https://github.com/Turbo87))
## [v0.18.0](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/tree/v0.18.0) (2017-10-03)

@@ -4,0 +59,0 @@ [Full Changelog](https://github.com/ember-cli/ember-cli-blueprint-test-helpers/compare/v0.17.2...v0.18.0)

@@ -5,2 +5,3 @@ 'use strict';

const rethrowFromErrorLog = require('./rethrow-from-error-log');
const cleanupENV = require('./helpers/cleanup-env');

@@ -13,3 +14,5 @@ /**

*/
module.exports = function(args) {
module.exports = function(args, options) {
options = options || {};
let commandArgs = ['destroy'].concat(args);

@@ -21,4 +24,9 @@

if (options.isModuleUnification) {
process.env["EMBER_CLI_MODULE_UNIFICATION"] = true
}
return ember(commandArgs, cliOptions)
.catch(rethrowFromErrorLog);
.catch(rethrowFromErrorLog)
.finally(cleanupENV);
};

@@ -23,3 +23,5 @@ 'use strict';

*/
module.exports = function(args, assertionCallback) {
module.exports = function(args, assertionCallback, options) {
options = options || {};
let paths = [];

@@ -32,5 +34,5 @@

return emberGenerate(args)
return emberGenerate(args, options)
.then(() => assertionCallback(_file))
.then(() => emberDestroy(args))
.then(() => emberDestroy(args, options))
.then(() => {

@@ -37,0 +39,0 @@ if (paths.length === 0) {

@@ -5,2 +5,3 @@ 'use strict';

const rethrowFromErrorLog = require('./rethrow-from-error-log');
const cleanupENV = require('./helpers/cleanup-env');

@@ -13,3 +14,5 @@ /**

*/
module.exports = function(args) {
module.exports = function(args, options) {
options = options || {};
let commandArgs = ['generate'].concat(args);

@@ -21,4 +24,9 @@

if (options.isModuleUnification) {
process.env["EMBER_CLI_MODULE_UNIFICATION"] = true
}
return ember(commandArgs, cliOptions)
.catch(rethrowFromErrorLog);
.catch(rethrowFromErrorLog)
.finally(cleanupENV);
};

@@ -9,2 +9,3 @@ 'use strict';

const rethrowFromErrorLog = require('./rethrow-from-error-log');
const cleanupENV = require('./helpers/cleanup-env');

@@ -31,6 +32,11 @@ /**

if (options.isModuleUnification) {
process.env["EMBER_CLI_MODULE_UNIFICATION"] = true
}
return ember([command, projectName, '--skip-npm', '--skip-bower'], cliOptions)
.then(generateInRepoAddon(target))
.then(linkAddon)
.catch(rethrowFromErrorLog);
.catch(rethrowFromErrorLog)
.finally(cleanupENV);
};

@@ -37,0 +43,0 @@

{
"name": "ember-cli-blueprint-test-helpers",
"version": "0.18.3",
"version": "0.19.0",
"description": "Blueprint test helpers for ember-cli. Mocks ember-cli for generate and destroy commands.",

@@ -29,3 +29,3 @@ "main": "index.js",

"ember-cli-internal-test-helpers": "^0.9.1",
"fs-extra": "^4.0.0",
"fs-extra": "^5.0.0",
"testdouble": "^3.2.6",

@@ -35,10 +35,13 @@ "tmp-sync": "^1.0.0"

"devDependencies": {
"ember-cli": "~2.16.0",
"ember-cli": "^3.5.0-beta.1",
"eslint": "^4.1.0",
"eslint-plugin-chai-expect": "^1.0.0",
"eslint-plugin-mocha": "^4.11.0",
"mocha": "^4.0.1",
"mocha": "^5.0.0",
"mocha-eslint": "^4.0.0",
"strip-ansi": "^4.0.0"
},
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
}

@@ -63,3 +63,3 @@

it('my-blueprint foo', function() {
var args = ['my-blueprint', 'foo'];
const args = ['my-blueprint', 'foo'];

@@ -91,3 +91,3 @@ // create a new Ember.js app in the working directory

it('my-blueprint foo', function() {
var args = ['my-blueprint', 'foo'];
const args = ['my-blueprint', 'foo'];

@@ -114,2 +114,35 @@ // create a new Ember.js app in the working directory

if your blueprints support the new
[MU file structure](https://github.com/emberjs/rfcs/pull/143), you can test them
using this option: `{ ìsModuleUnification: true }`
```js
describe('Acceptance: ember generate and destroy my-blueprint', function() {
// create and destroy temporary working directories
setupTestHooks(this);
it('my-blueprint foo', function() {
const args = ['my-blueprint', 'foo'];
// create a new Ember.js app in the working directory
// this app will have MU file structure, namely a `src` directory
return emberNew({ isModuleUnification: true })
// then generate the `my-blueprint` blueprint called `foo`
.then(() => emberGenerate(args, { isModuleUnification: true }))
// 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, { isModuleUnification: true }))
// then assert that the files were destroyed correctly
.then(() => expect(file('path/to/file.js')).to.not.exist);
});
});
```
API Reference

@@ -158,2 +191,3 @@ ------------------------------------------------------------------------------

- `{String} [options.target='app']` the type of project to create (`app`, `addon` or `in-repo-addon`)
- `{Boolean} [options.isModuleUnification=true]` a toggle to use MU file structure

@@ -164,3 +198,3 @@ **Returns:** `{Promise}`

### `emberGenerate(args)`
### `emberGenerate(args, options)`

@@ -172,2 +206,4 @@ Run a blueprint generator.

- `{Array.<String>} args` arguments to pass to `ember generate` (e.g. `['my-blueprint', 'foo']`)
- `{Object} [options]` optional parameters
- `{Boolean} [options.isModuleUnification=true]` a toggle to use MU file structure

@@ -178,3 +214,3 @@ **Returns:** `{Promise}`

### `emberDestroy(args)`
### `emberDestroy(args, options)`

@@ -186,2 +222,4 @@ Run a blueprint destructor.

- `{Array.<String>} args` arguments to pass to `ember destroy` (e.g. `['my-blueprint', 'foo']`)
- `{Object} [options]` optional parameters
- `{Boolean} [options.isModuleUnification=true]` a toggle to use MU file structure

@@ -192,3 +230,3 @@ **Returns:** `{Promise}`

### `emberGenerateDestroy(args, assertionCallback)`
### `emberGenerateDestroy(args, assertionCallback, options)`

@@ -202,2 +240,4 @@ Run a blueprint generator and the corresponding blueprint destructor while

- `{Function} assertionCallback` the callback function in which the assertions should happen
- `{Object} [options]` optional parameters
- `{Boolean} [options.isModuleUnification=true]` a toggle to use MU file structure

@@ -204,0 +244,0 @@ **Returns:** `{Promise}`

@@ -7,3 +7,6 @@ 'use strict';

const emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy;
const emberGenerate = blueprintHelpers.emberGenerate;
const emberDestroy = blueprintHelpers.emberDestroy;
const path = require('path');
const fs = require('fs');

@@ -13,18 +16,101 @@ const chai = require('../../chai');

const dir = chai.dir;
const file = chai.file;
describe('Acceptance: helpers', function() {
setupTestHooks(this);
describe('emberNew', () => {
it('emberNew - classic app', () => {
return emberNew()
.then(() => {
const appPath = path.resolve(process.cwd(), 'app');
expect(fs.existsSync(appPath)).to.equal(true);
});
});
it('emberNew - classic addon', () => {
return emberNew({ target: 'addon' })
.then(() => {
const addonPath = path.resolve(process.cwd(), 'addon');
expect(fs.existsSync(addonPath)).to.equal(true);
});
});
it('emberNew - MU app', () => {
return emberNew({ isModuleUnification: true })
.then(() => {
const srcPath = path.resolve(process.cwd(), 'src');
expect(fs.existsSync(srcPath)).to.equal(true);
})
.then(() => {
expect(process.env["EMBER_CLI_MODULE_UNIFICATION"]).to.equal(undefined);
});
});
});
describe('emberGenerateDestroy', () => {
it('blueprint-test foo', () => {
it('blueprint-test foo - in a classic app', () => {
return emberNew()
.then(() => emberGenerateDestroy(['blueprint-test', 'foo'], (file) => {
expect(file('node-tests/blueprints/foo-test.js'))
.to.contain('return emberNew()')
.to.contain('.then(() => emberGenerateDestroy(args, (file) => {');
.to.contain('return emberNew()');
}));
});
it('blueprint-test foo - in a MU app with no flag', () => {
return emberNew({ isModuleUnification: true })
.then(() => emberGenerateDestroy(['blueprint-test', 'foo'], (file) => {
expect(file('node-tests/blueprints/foo-test.js'))
.to.contain('return emberNew()');
}));
});
it('blueprint-test foo - in a MU app with MU flag', () => {
return emberNew({ isModuleUnification: true })
.then(() => emberGenerateDestroy(['blueprint-test', 'foo'], (file) => {
expect(file('node-tests/blueprints/foo-test.js'))
.to.contain('return emberNew({ isModuleUnification: true })');
}, { isModuleUnification: true }))
.then(() => {
expect(process.env["EMBER_CLI_MODULE_UNIFICATION"]).to.equal(undefined);
});
});
});
describe('emberGenerate and emberDestroy', () => {
it('blueprint-test foo - in a classic app', () => {
const args = ['blueprint-test', 'foo'];
return emberNew()
.then(() => emberGenerate(args))
.then(() => {
expect(file('node-tests/blueprints/foo-test.js'))
.to.contain('return emberNew()');
})
.then(() => emberDestroy(args))
.then(() => {
expect(file('node-tests/blueprints/foo-test.js')).to.not.exist;
});
});
it('blueprint-test foo - in a MU app', () => {
const args = ['blueprint-test', 'foo'];
return emberNew({ isModuleUnification: true })
.then(() => emberGenerate(args, { isModuleUnification: true }))
.then(() => {
expect(file('node-tests/blueprints/foo-test.js'))
.to.contain('return emberNew({ isModuleUnification: true })');
})
.then(() => emberDestroy(args, { isModuleUnification: true }))
.then(() => {
expect(file('node-tests/blueprints/foo-test.js')).to.not.exist;
expect(process.env["EMBER_CLI_MODULE_UNIFICATION"]).to.equal(undefined);
});
});
});
describe('setupTestHooks', () => {
var symlink = path.resolve(__dirname, '..', '..', 'node_modules', 'ember-cli-blueprint-test-helpers');
const symlink = path.resolve(__dirname, '..', '..', 'node_modules', 'ember-cli-blueprint-test-helpers');

@@ -31,0 +117,0 @@ after(() => {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc