New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ember-cli-mocha

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-mocha - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

blueprints/component-test/files/tests/__testType__/__path__/__test__.js

83

blueprints/component-test/index.js

@@ -0,10 +1,19 @@

/*jshint node:true*/
var EOL = require('os').EOL;
module.exports = {
description: 'Generates a component test.',
description: 'Generates a component integration or unit test.',
availableOptions: [
{
name: 'integration',
type: Boolean,
default: false,
aliases: ['i']
name: 'test-type',
type: ['integration', 'unit'],
default: 'integration',
aliases: [
{ 'i': 'integration'},
{ 'u': 'unit'},
{ 'integration': 'integration' },
{ 'unit': 'unit' }
]
}

@@ -14,49 +23,47 @@ ],

locals: function(options) {
var additionalImports, prefix, testOpts, defaultTest;
if (options.integration) {
additionalImports = "import hbs from 'htmlbars-inline-precompile';";
var testImports, prefix, testOpts, testContent;
if (options.testType === 'unit') {
testImports = '';
prefix = '';
testOpts = "// specify the other units that are required for this test" + EOL +
" // needs: ['component:foo', 'helper:bar']";
testContent = "// creates the component instance" + EOL +
" var component = this.subject();" + EOL +
" // renders the component on the page" + EOL +
" this.render();" + EOL +
" expect(component).to.be.ok;" + EOL +
" expect(this.$()).to.have.length(1);";
} else {
testImports = EOL + "import hbs from 'htmlbars-inline-precompile';";
prefix = 'Integration: ';
testOpts = 'integration: true';
defaultTest = "// renders the component on the page\n" +
" this.render(hbs`{{" + options.entity.name + "}}`);\n" +
" expect(this.$()).to.be.ok;";
} else {
additionalImports = '';
prefix = '';
testOpts = "// specify the other units that are required for this test\n" +
" // needs: ['component:foo', 'helper:bar']";
defaultTest = "// creates the component instance\n" +
" var component = this.subject();\n" +
" expect(component._state).to.equal('preRender');\n\n" +
" // renders the component on the page\n" +
" this.render();\n" +
" expect(component._state).to.equal('inDOM');";
testContent = "// Set any properties with this.set('myProperty', 'value');" + EOL +
" // Handle any actions with this.on('myAction', function(val) { ... });" + EOL +
" // Template block usage:" + EOL +
" // this.render(hbs`" + EOL +
" // {{#" + options.entity.name + "}}" + EOL +
" // template content" + EOL +
" // {{/" + options.entity.name + "}}" + EOL +
" // `);" + EOL + EOL +
" this.render(hbs`{{" + options.entity.name + "}}`);" + EOL +
" expect(this.$()).to.have.length(1);";
}
return {
additionalImports: additionalImports,
testImports: testImports,
testPrefix: prefix,
testOpts: testOpts,
defaultTest: defaultTest,
integration: options.integration
testContent: testContent,
integration: options.integration,
testType: options.testType
};
},
fileMapTokens: function(options) {
fileMapTokens: function() {
return {
__testfolder__: function(options) {
if (options.locals.integration) {
return 'integration';
} else {
return 'unit';
}
__testType__: function(options) {
return options.locals.testType || 'integration';
}
};
},
afterInstall: function(options) {
if (!options.integration) { return; }
return this.addPackageToProject('ember-cli-htmlbars-inline-precompile', '^0.1.1');
}
};

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

/*jshint node:true*/
'use strict';

@@ -50,2 +52,6 @@

}
if (packages.indexOf('ember-cli-htmlbars-inline-precompile') < 0) {
console.warn('\nIt looks like you\'re not on ember-cli 1.13, which includes ember-cli-htmlbars-inline-precompile by default. Please run: ember install ember-cli-htmlbars-inline-precompile.\n');
process.exit(1);
}
},

@@ -52,0 +58,0 @@

{
"name": "ember-cli-mocha",
"version": "0.8.0",
"version": "0.9.0",
"description": "Mocha and Chai tests for ember-cli applications",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -7,13 +7,6 @@ # ember-cli-mocha

Remove QUnit from your ember-cli app:
```sh
npm rm ember-cli-qunit --save-dev
```
Install ember-cli-mocha:
```sh
npm install ember-cli-mocha --save-dev
ember generate ember-cli-mocha
ember install ember-cli-mocha
```

@@ -20,0 +13,0 @@

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