ember-cli-internal-test-helpers
Advanced tools
Comparing version 0.4.0 to 0.5.0
@@ -9,2 +9,3 @@ 'use strict'; | ||
var EOL = require('os').EOL; | ||
var walkSync = require('walk-sync'); | ||
var existsSync = require('exists-sync'); | ||
@@ -42,10 +43,25 @@ | ||
module.exports = function assertFile(file, options) { | ||
// console.log(process.cwd(), file) | ||
var filePath = path.join(process.cwd(), file); | ||
expect(existsSync(filePath)).to.equal(true, 'expected ' + file + ' to exist'); | ||
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'); | ||
if (!options) { | ||
debug('no options, returning.'); | ||
// console.log('no options') | ||
return; | ||
} | ||
var actual = fs.readFileSync(filePath, { encoding: 'utf-8' }); | ||
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) { | ||
@@ -82,3 +98,2 @@ flatten([options.contains]).forEach(function(expected) { | ||
} | ||
expect(pass).to.equal(true, EOL + EOL + 'expected ' + file + ':' + EOL + EOL + | ||
@@ -90,2 +105,8 @@ actual + EOL + | ||
} | ||
if (options.isEmpty) { | ||
expect(actual).to.equal('', EOL + EOL + 'expected ' + file + ':' + EOL + EOL + | ||
actual + EOL + | ||
'to be empty.' + EOL); | ||
} | ||
}; | ||
@@ -92,0 +113,0 @@ |
{ | ||
"name": "ember-cli-internal-test-helpers", | ||
"version": "0.4.0", | ||
"version": "0.5.0", | ||
"description": "Internal test helpers for ember-cli", | ||
@@ -31,3 +31,4 @@ "main": "index.js", | ||
"symlink-or-copy": "^1.0.1", | ||
"through": "^2.3.8" | ||
"through": "^2.3.8", | ||
"walk-sync": "^0.2.6" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies": { |
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
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
18962
570
10
+ Addedwalk-sync@^0.2.6
+ Addedensure-posix-path@1.1.1(transitive)
+ Addedmatcher-collection@1.1.2(transitive)
+ Addedwalk-sync@0.2.7(transitive)