yeoman-assert
Advanced tools
Comparing version 1.0.0 to 2.0.0
64
index.js
@@ -15,8 +15,3 @@ /** | ||
var _ = require('lodash'); | ||
var chalk = require('chalk'); | ||
function deprecate (message) { | ||
console.log(chalk.yellow('(!) ') + message); | ||
} | ||
function extractMethods(methods) { | ||
@@ -43,11 +38,2 @@ return _.isArray(methods) ? methods : Object.keys(methods).filter(function (method) { | ||
* assert.file(['templates/user.hbs', 'templates/user/edit.hbs']); | ||
* | ||
* @also | ||
* | ||
* Assert that a file's content matches a regex | ||
* @deprecated | ||
* @param {String} path - path to a file | ||
* @param {Regex} reg - regex that will be used to search the file | ||
* @example | ||
* assert.file('models/user.js', /App\.User = DS\.Model\.extend/); | ||
*/ | ||
@@ -57,14 +43,7 @@ | ||
var args = _.toArray(arguments); | ||
if (_.last(args) instanceof RegExp) { // DEPRECATED CASE | ||
var depMsg = 'assert.file(String, RegExp) DEPRECATED; use '; | ||
depMsg += 'assert.fileContent(String, RegExp) instead.'; | ||
deprecate(depMsg); | ||
assert.fileContent(args[0], args[1]); | ||
} else { | ||
args = _.isString(args[0]) ? args : args[0]; | ||
args.forEach(function (file) { | ||
var here = fs.existsSync(file); | ||
assert.ok(here, file + ', no such file or directory'); | ||
}); | ||
} | ||
args = _.isString(args[0]) ? args : args[0]; | ||
args.forEach(function (file) { | ||
var here = fs.existsSync(file); | ||
assert.ok(here, file + ', no such file or directory'); | ||
}); | ||
}; | ||
@@ -96,35 +75,2 @@ | ||
/** | ||
* Assert that each of an array of files exists. If an item is an array with | ||
* the first element a filepath and the second element a regex, check to see | ||
* that the file content matches the regex | ||
* | ||
* @deprecated | ||
* @param {Array} pairs - an array of paths to files or file/regex subarrays | ||
* | ||
* @example | ||
* file(['templates/user.hbs', 'templates/user/edit.hbs']); | ||
* | ||
* @example | ||
* files(['foo.js', 'bar.js', ['baz.js', /function baz/]]); | ||
*/ | ||
assert.files = function (files) { | ||
var depMsg = 'assert.files deprecated. Use '; | ||
depMsg += 'assert.file([String, String, ...]) or '; | ||
depMsg += 'assert.file([[String, RegExp], [String, RegExp]...]) instead.'; | ||
deprecate(depMsg); | ||
files.forEach(function (item) { | ||
var file = item; | ||
var rx; | ||
if (item instanceof Array) { | ||
file = item[0]; | ||
rx = item[1]; | ||
assert.fileContent(file, rx); | ||
} else { | ||
assert.file(file); | ||
} | ||
}); | ||
}; | ||
/** | ||
* Assert that a file's content matches a regex or string | ||
@@ -131,0 +77,0 @@ * @param {String} file - path to a file |
{ | ||
"name": "yeoman-assert", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Assert utility from yeoman", | ||
@@ -25,10 +25,9 @@ "license": "BSD", | ||
"dependencies": { | ||
"chalk": "^0.5.1", | ||
"lodash": "^2.4.1" | ||
"lodash": "^3.6.0" | ||
}, | ||
"devDependencies": { | ||
"jscs": "^1.7.3", | ||
"jshint": "^2.5.10", | ||
"jscs": "^1.12.0", | ||
"jshint": "^2.6.3", | ||
"mocha": "*" | ||
} | ||
} |
@@ -22,3 +22,3 @@ # yeoman-assert [](https://travis-ci.org/yeoman/yeoman-assert) | ||
``` | ||
```js | ||
assert.file('templates/user.hbs'); | ||
@@ -29,3 +29,3 @@ ``` | ||
``` | ||
```js | ||
assert.file(['templates/user.hbs', 'templates/user/edit.hbs']); | ||
@@ -42,3 +42,3 @@ | ||
``` | ||
```js | ||
assert.noFile('templates/user.hbs'); | ||
@@ -49,3 +49,3 @@ ``` | ||
``` | ||
```js | ||
assert.noFile(['templates/user.hbs', 'templates/user/edit.hbs']); | ||
@@ -60,6 +60,6 @@ | ||
- **reg** (Regex|String) Regex or string that will be used to search the file. | ||
Assert that a file's content matches a string. | ||
``` | ||
```js | ||
assert.fileContent('models/user.js', 'App.User = DS.Model.extend'); | ||
@@ -71,3 +71,3 @@ | ||
``` | ||
```js | ||
assert.fileContent('models/user.js', /App\.User = DS\.Model\.extend/); | ||
@@ -78,3 +78,3 @@ ``` | ||
``` | ||
```js | ||
assert.fileContent([ | ||
@@ -92,5 +92,5 @@ ['models/user.js', 'App.User = DS.Model.extend'], | ||
Assert that a file's content does not matche a string. | ||
Assert that a file's content does not match a string. | ||
``` | ||
```js | ||
assert.fileContent('models/user.js', 'App.User = DS.Model.extend'); | ||
@@ -100,5 +100,5 @@ | ||
Assert that a file's content does not matche a regex. | ||
Assert that a file's content does not match a regex. | ||
``` | ||
```js | ||
assert.fileContent('models/user.js', /App\.User = DS\.Model\.extend/); | ||
@@ -109,3 +109,3 @@ ``` | ||
``` | ||
```js | ||
assert.fileContent([ | ||
@@ -124,3 +124,3 @@ ['models/user.js', 'App.User = DS.Model.extend'], | ||
``` | ||
```js | ||
assert.textEqual('I have a yellow cat', 'I have a yellow cat'); | ||
@@ -137,3 +137,3 @@ ``` | ||
``` | ||
```js | ||
yoAssert.notImplement(fs, ['readFile']); | ||
@@ -150,3 +150,3 @@ ``` | ||
``` | ||
```js | ||
yoAssert.notImplement(fs, ['foo']); | ||
@@ -153,0 +153,0 @@ ``` |
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
1
9459
166
1
+ Addedlodash@3.10.1(transitive)
- Removedchalk@^0.5.1
- Removedansi-regex@0.2.1(transitive)
- Removedansi-styles@1.1.0(transitive)
- Removedchalk@0.5.1(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-ansi@0.1.0(transitive)
- Removedlodash@2.4.2(transitive)
- Removedstrip-ansi@0.3.0(transitive)
- Removedsupports-color@0.2.0(transitive)
Updatedlodash@^3.6.0