ember-cli-internal-test-helpers
Advanced tools
Comparing version 0.8.1 to 0.8.2
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
27581
12
37
778
1
8
4
4
3
+ Addedchai-files@^1.1.0
+ Addedchai-as-promised@6.0.0(transitive)
+ Addedchai-files@1.4.0(transitive)
+ Addedcheck-error@1.0.3(transitive)
+ Addedfs-extra@0.30.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-func-name@2.0.2(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedklaw@1.3.1(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedwalk-sync@0.3.4(transitive)
- Removedconfigstore@^1.2.1
- Removedcpr@^0.4.2
- Removedchai-as-promised@5.3.0(transitive)
- Removedconfigstore@1.4.0(transitive)
- Removedcpr@0.4.3(transitive)
- Removedfs-extra@0.24.0(transitive)
- Removedglob@6.0.4(transitive)
- Removedgraceful-fs@4.1.15(transitive)
- Removedimurmurhash@0.1.4(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedos-homedir@1.0.2(transitive)
- Removedos-tmpdir@1.0.2(transitive)
- Removedosenv@0.1.5(transitive)
- Removedrimraf@2.4.5(transitive)
- Removedslide@1.1.6(transitive)
- Removeduuid@2.0.3(transitive)
- Removedwalk-sync@0.2.7(transitive)
- Removedwrite-file-atomic@1.3.4(transitive)
- Removedxdg-basedir@2.0.0(transitive)
Updatedchai-as-promised@^6.0.0
Updatedfs-extra@^0.30.0
Updatedwalk-sync@^0.3.1