Socket
Socket
Sign inDemoInstall

ember-cli-addon-tests

Package Overview
Dependencies
Maintainers
5
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-addon-tests - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

2

lib/commands/start-server.js

@@ -53,3 +53,3 @@ "use strict";

'Ember FastBoot running at',
'Serving on'
'Build successful'
];

@@ -56,0 +56,0 @@

@@ -5,2 +5,3 @@ var path = require('path');

var runCommand = require('../utilities/run-command');
var killCliProcess = require('../utilities/kill-cli-process');
var RSVP = require('rsvp');

@@ -50,3 +51,3 @@

this.server.kill('SIGINT');
killCliProcess(this.server);
this.server = null;

@@ -53,0 +54,0 @@

{
"name": "ember-cli-addon-tests",
"version": "0.7.0",
"version": "0.7.1",
"description": "A set of integration test helpers for Ember CLI addons",

@@ -24,3 +24,3 @@ "keywords": [

"dependencies": {
"chalk": "^1.1.3",
"chalk": "^2.0.1",
"cpr": "^2.0.0",

@@ -40,8 +40,8 @@ "debug": "^2.2.0",

"devDependencies": {
"chai": "^3.5.0",
"cross-env": "^4.0.0",
"chai": "^4.0.2",
"cross-env": "^5.0.0",
"ember-cli": "~2.13.0",
"ember-cli-fastboot": "1.0.0-beta.18",
"ember-cli-fastboot": "1.0.0-rc3",
"mocha": "^3.1.2",
"mocha-eslint": "^3.0.1",
"mocha-eslint": "^4.0.0",
"request": "^2.75.0"

@@ -48,0 +48,0 @@ },

@@ -1,2 +0,2 @@

## Ember CLI Addon Tests
# Ember CLI Addon Tests

@@ -22,3 +22,3 @@ [![Greenkeeper badge](https://badges.greenkeeper.io/tomdale/ember-cli-addon-tests.svg)](https://greenkeeper.io/)

### Installation
## Installation

@@ -29,25 +29,23 @@ ```sh

### Example
## Example
```js
var expect = require('chai').expect;
var RSVP = require('rsvp');
var request = RSVP.denodeify(require('request'));
var AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
'use strict';
const expect = require('chai').expect;
const RSVP = require('rsvp');
const request = RSVP.denodeify(require('request'));
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
describe('serve assets acceptance', function() {
this.timeout(300000);
var app;
let app;
before(function() {
app = new AddonTestApp();
return app.create('dummy')
.then(function() {
return app.startServer({
command: 'fastboot',
additionalArguments: ['--serve-assets']
});
.then(() => {
return app.startServer();
});

@@ -60,5 +58,19 @@ });

it('/index.html', function() {
return request({
url: 'http://localhost:49741',
headers: {
'Accept': 'text/html'
}
})
.then(response => {
expect(response.statusCode).to.equal(200);
expect(response.headers["content-type"]).to.eq("text/html");
expect(response.body).to.contain("<body>");
});
});
it('/assets/vendor.js', function() {
return request('http://localhost:49741/assets/vendor.js')
.then(function(response) {
.then(response => {
expect(response.statusCode).to.equal(200);

@@ -72,3 +84,3 @@ expect(response.headers["content-type"]).to.eq("application/javascript");

return request('http://localhost:49741/assets/dummy.js')
.then(function(response) {
.then(response => {
expect(response.statusCode).to.equal(200);

@@ -85,3 +97,3 @@ expect(response.headers["content-type"]).to.eq("application/javascript");

### Defining a New App
## Defining a New App

@@ -91,7 +103,7 @@ Creates a new app for testing.

```js
var AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
const AddonTestApp = require('ember-cli-addon-tests').AddonTestApp;
app = new AddonTestApp();
```
### Creating the App
## Creating the App

@@ -108,4 +120,10 @@ This starts the process of actually creating a new Ember CLI app on

#### Options
### "Precooking" Node Modules
You can "precook" (essentially pre-install) the node modules for the test
applications by using `scripts/precook-node-modules.js`. This will speed up
test runs by configuring a `node_modules` directory that will be reused.
### Options
You can customize the app by supplying an options hash:

@@ -130,3 +148,3 @@

#### Fixtures
### Fixtures

@@ -145,4 +163,16 @@ You will probably want to add files to the Ember application that you

### Editing App's `package.json`
Once the promise resolves, you can inspect the temporary location of the
app under test via `app.path`:
```js
app.create('my-app').then(() => {
console.log(app.path);
// /var/folders/vc/wjjhq0f542q3dn2109clfy81dlk662/T/d-117613-7500-1bq89dh.8ts6wuq5mi/under-test/my-app
// or
// C:\Users\kelly\AppData\Local\Temp\d-117613-15884-1j1bw40.5kbh\under-test\my-app
});
```
## Editing App's `package.json`
If your addon depends on end developers configuring their application's

@@ -154,3 +184,3 @@ `package.json`, you can edit the test app's `package.json` with the

// runs synchronously
app.editPackageJSON(function(pkg) {
app.editPackageJSON(pkg => {
pkg.devDependencies['fake-addon'] = "*";

@@ -164,6 +194,6 @@ pkg.devDependencies['fake-addon-2'] = "*";

### Starting the Server
## Starting the Server
To test the assets served by Ember CLI, you can start the server (i.e.,
`ember server`) via the `startServer()` method:
`ember serve`) via the `startServer()` method:

@@ -175,11 +205,2 @@ ```js

If you want to run a different command that starts the server, you can
pass the `command` option:
```js
// Runs `ember fastboot` inside the app instead of `ember server`
app.startServer({
command: 'fastboot'
});
```
You can also pass additional command line arguments via the

@@ -189,9 +210,9 @@ `additionalArguments` option:

```js
// equivalent to `ember server --serve-assets`
// equivalent to `ember serve --production`
app.startServer({
additionalArguments: ['--serve-assets']
additionalArguments: ['--production']
});
```
### Stopping the Server
## Stopping the Server

@@ -204,3 +225,3 @@ After your tests, stop the development server via `stopServer()`.

### Running Commands
## Running Commands

@@ -215,3 +236,3 @@ You can run arbitrary commands inside the test app via the `run()`

### Running Ember CLI Commands
## Running Ember CLI Commands

@@ -222,8 +243,8 @@ You can run commands using the app's version of Ember CLI via the

```js
// equivalent to `ember fastboot:build --environment production`
app.runEmberCommand('fastboot:build', '--environment', 'production');
// equivalent to `ember build --environment production`
app.runEmberCommand('build', '--environment', 'production');
```
### Cleanup
## Cleanup
Temporary directories are automatically deleted once the process exits.

@@ -6,2 +6,4 @@ "use strict";

var fs = require('fs-promise');
var readJsonSync = require('fs-extra').readJsonSync;
var findup = require('findup-sync');

@@ -14,13 +16,16 @@ var moveDirectory = require('../lib/utilities/move-directory');

var root = process.cwd();
var name = 'precooked-app';
var appName = 'precooked-app';
var pkg = findup('package.json');
var name = readJsonSync(pkg).name;
fs.ensureDir('tmp')
.then(function() {
process.chdir(tmpDir);
return runNew(name);
return runNew(appName);
})
.then(function() {
var precooked = path.join(root, 'tmp', 'precooked_node_modules');
moveDirectory(path.join(tmpDir, name, 'node_modules'), precooked);
symlinkDirectory(root, path.join(precooked, 'ember-cli-fastboot'));
moveDirectory(path.join(tmpDir, appName, 'node_modules'), precooked);
symlinkDirectory(root, path.join(precooked, name));
})

@@ -27,0 +32,0 @@ .catch(function(e) {

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