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

ember-cli-internal-test-helpers

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.8.1 to 0.8.2

.editorconfig

9

lib/helpers/acceptance.js

@@ -10,6 +10,5 @@ 'use strict';

var tmp = require('./tmp');
var conf = require('./conf');
var copy = Promise.denodeify(require('cpr'));
var root = process.cwd();
var exec = Promise.denodeify(require('child_process').exec);
var copy = Promise.denodeify(fs.copy);

@@ -73,3 +72,2 @@ var runCommandOptions = {

process.chdir('./common-tmp');
conf.setup();
return command();

@@ -133,9 +131,6 @@ });

* Tears down the targeted project download directory
* and restores conf.
* @return {Promise}
*/
function teardownTestTargets() {
return tmp.teardown('./common-tmp').then(function() {
conf.restore();
});
return tmp.teardown('./common-tmp');
}

@@ -142,0 +137,0 @@

'use strict';
var expect = require('chai').expect;
var fs = require('fs');
var chai = require('chai');
var chaiFiles = require('chai-files');
chai.use(chaiFiles);
var expect = chai.expect;
var file = chaiFiles.file;
/*

@@ -14,6 +19,3 @@ Assert that a given file matches another.

module.exports = function assertFileEquals(pathToActual, pathToExpected) {
var actual = fs.readFileSync(pathToActual, { encoding: 'utf-8' });
var expected = fs.readFileSync(pathToExpected, { encoding: 'utf-8' });
expect(actual).to.equal(expected);
expect(file(pathToActual)).to.equal(file(pathToExpected));
};
'use strict';
var expect = require('chai').expect;
var fs = require('fs');
var chai = require('chai');
var chaiFiles = require('chai-files');
chai.use(chaiFiles);
var expect = chai.expect;
var file = chaiFiles.file;
/*

@@ -13,13 +18,3 @@ Assert that a file does not exist, for ensuring certain files aren't generated

module.exports = function assertFileToNotExist(pathToCheck) {
var exists;
try {
exists = fs.readFileSync(pathToCheck, { encoding: 'utf-8' });
} catch (e) {
if (e.code === 'ENOENT') {
exists = null;
} else {
throw e;
}
}
expect(exists).to.not.exist;
expect(file(pathToCheck)).to.not.exist;
};
'use strict';
var expect = require('chai').expect;
var flatten = require('lodash/flatten');
var contains = require('lodash/includes');
var fs = require('fs-extra');
var path = require('path');
var EOL = require('os').EOL;
var walkSync = require('walk-sync');
var existsSync = require('exists-sync');
var debug = require('debug')('ember-cli-internal-test-helpers:assert-file');
var chai = require('chai');
var chaiFiles = require('chai-files');
chai.use(chaiFiles);
var expect = chai.expect;
var file = chaiFiles.file;
/*

@@ -35,3 +35,3 @@ Asserts that a given file exists.

@method assertFile
@param {String} file
@param {String} path
@param {Object} options

@@ -44,45 +44,18 @@ Optional extra assertions to perform on the file.

*/
module.exports = function assertFile(file, options) {
// console.log(process.cwd(), file)
var filePath = path.join(process.cwd(), file);
var exists = existsSync(filePath);
// console.log(filePath + ' exists: ',exists)
if(!exists) {
debug(filePath + ' contents:')
debug(walkSync(process.cwd()))
}
expect(exists).to.equal(true, 'expected ' + file + ' to exist');
module.exports = function assertFile(path, options) {
var f = file(path);
expect(f).to.exist;
if (!options) {
debug('no options, returning.');
// console.log('no options')
return;
}
try {
// console.log('trying to read: ', filePath)
var actual = fs.readFileSync(filePath, { encoding: 'utf-8' });
} catch (err) {
console.log('content assert read error')
// console.error(err.message);
// console.error(err.stack);
throw err;
}
if (options.contains) {
flatten([options.contains]).forEach(function(expected) {
var pass;
if (expected.test) {
pass = expected.test(actual);
expect(f).to.match(expected);
} else {
pass = contains(actual, expected);
expect(f).to.contain(expected);
}
var message = 'expected: `' + file + '`';
if (pass) {
expect(true).to.equal(true, EOL + EOL + 'expected ' + file + ':' + EOL + EOL +
actual +
EOL + 'to contain:' + EOL + EOL +
expected + EOL);
} else {
throw new EqualityError(message, actual, expected);
}
});

@@ -93,33 +66,13 @@ }

flatten([options.doesNotContain]).forEach(function(unexpected) {
var pass;
if (unexpected.test) {
pass = !unexpected.test(actual);
expect(f).to.not.match(unexpected);
} else {
pass = !contains(actual, unexpected);
expect(f).to.not.contain(unexpected);
}
expect(pass).to.equal(true, EOL + EOL + 'expected ' + file + ':' + EOL + EOL +
actual + EOL +
'not to contain:' + EOL + EOL +
unexpected + EOL);
});
}
if (options.isEmpty) {
expect(actual).to.equal('', EOL + EOL + 'expected ' + file + ':' + EOL + EOL +
actual + EOL +
'to be empty.' + EOL);
expect(f).to.equal('');
}
};
function EqualityError(message, actual, expected) {
this.message = message;
this.actual = actual;
this.expected = expected;
this.showDiff = true;
Error.captureStackTrace(this, module.exports);
}
EqualityError.prototype = Object.create(Error.prototype);
EqualityError.prototype.name = 'EqualityError';
EqualityError.prototype.constructor = EqualityError;

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

var Promise = require('rsvp');
var copy = Promise.denodeify(require('cpr'));
var fs = require('fs-extra');
var copy = Promise.denodeify(fs.copy);

@@ -11,6 +12,3 @@ var rootPath = process.cwd();

module.exports = function copyFixtureFiles(sourceDir) {
return copy(path.join(rootPath, 'tests', 'fixtures', sourceDir), '.', {
clobber: true,
stopOnErr: true
});
return copy(path.join(rootPath, 'tests', 'fixtures', sourceDir), '.', { clobber: true });
};

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

function logOnFailure(s) {
if (logSink == null) {
if (logSink === null) {
throw(new Error('logOnFailure called outside of test'));

@@ -24,0 +24,0 @@ } else {

'use strict';
var Promise = require('rsvp');
var Promise = require('rsvp').Promise;
var chalk = require('chalk');

@@ -5,0 +5,0 @@ var spawn = require('child_process').spawn;

{
"name": "ember-cli-internal-test-helpers",
"version": "0.8.1",
"version": "0.8.2",
"description": "Internal test helpers for ember-cli",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"coverage": "istanbul cover node_modules/mocha/bin/_mocha",
"test": "mocha",
"preversion": "npm test",
"postversion": "git push origin master --follow-tags && npm publish"
},

@@ -24,9 +27,8 @@ "repository": {

"chai": "^3.3.0",
"chai-as-promised": "^5.1.0",
"chai-as-promised": "^6.0.0",
"chai-files": "^1.1.0",
"chalk": "^1.1.1",
"configstore": "^1.2.1",
"cpr": "^0.4.2",
"debug": "^2.2.0",
"exists-sync": "0.0.3",
"fs-extra": "^0.24.0",
"fs-extra": "^0.30.0",
"lodash": "^4.0.0",

@@ -36,4 +38,10 @@ "rsvp": "^3.0.17",

"through": "^2.3.8",
"walk-sync": "^0.2.6"
"walk-sync": "^0.3.1"
},
"devDependencies": {
"eslint-plugin-chai-expect": "^1.1.1",
"istanbul": "^0.4.2",
"mocha": "^3.0.2",
"mocha-eslint": "^2.0.2"
}
}
ember-cli-internal-test-helpers
===============================
Internal test helpers for ember-cli.
[![Travis CI](https://img.shields.io/travis/ember-cli/ember-cli-internal-test-helpers/master.svg)](https://travis-ci.org/ember-cli/ember-cli-internal-test-helpers)
[![AppVeyor](https://ci.appveyor.com/api/projects/status/github/ember-cli/ember-cli-internal-test-helpers?svg=true)](https://ci.appveyor.com/project/embercli/ember-cli-internal-test-helpers/branch/master)
Internal test helpers for ember-cli.

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