Socket
Socket
Sign inDemoInstall

expect

Package Overview
Dependencies
0
Maintainers
1
Versions
236
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.3.0

21

modules/expect.js

@@ -72,10 +72,15 @@ var assert = require('assert');

Expectation.prototype.toBeA = function (constructor, message) {
Expectation.prototype.toBeA = function (value, message) {
assert(
isFunction(constructor),
'The constructor used in toBeA/toBeAn must be a function'
isFunction(value) || typeof value === 'string',
'The expected value used in toBeA/toBeAn must be a function or string'
);
message = message || inspect(this.actual) + ' is not a ' + (constructor.name || constructor.toString());
assert(this.actual instanceof constructor, message);
if (isFunction(value)) {
message = message || inspect(this.actual) + ' is not a ' + (value.name || value.toString());
assert(this.actual instanceof value, message);
} else {
message = message || inspect(this.actual) + ' is not a(n) ' + value;
assert(typeof this.actual === value, message);
}

@@ -88,3 +93,3 @@ return this;

isRegExp(pattern),
'The pattern used in toMatch must be a RegExp'
'The expected value used in toMatch must be a RegExp'
);

@@ -113,3 +118,3 @@

isArray(this.actual) || typeof this.actual === 'string',
'The actual value used in toInclude/toContain must be an Array or String'
'The actual value used in toInclude/toContain must be an array or string'
);

@@ -142,3 +147,3 @@

isArray(this.actual) || typeof this.actual === 'string',
'The actual value used in toExclude/toNotContain must be an Array or String'
'The actual value used in toExclude/toNotContain must be an array or string'
);

@@ -145,0 +150,0 @@

{
"name": "expect",
"version": "1.2.0",
"version": "1.3.0",
"description": "Write better assertions",

@@ -19,3 +19,3 @@ "main": "modules/expect.js",

"scripts": {
"dist": "webpack modules/expect.js dist/expect.min.js",
"dist": "webpack -p modules/expect.js dist/expect.min.js",
"test": "jshint . && mocha --reporter spec 'modules/**/__tests__/*-test.js'",

@@ -22,0 +22,0 @@ "test-browser": "karma start"

@@ -68,2 +68,10 @@ [![npm package](https://img.shields.io/npm/v/expect.svg?style=flat-square)](https://www.npmjs.org/package/expect)

#### expect(object).toBeA(string, [message])
Asserts the `typeof` the given `object` is `string`.
```js
expect(2).toBeA('number');
```
#### expect(string).toMatch(pattern, [message])

@@ -70,0 +78,0 @@

@@ -1,9 +0,3 @@

var webpack = require('webpack');
module.exports = {
node: {
buffer: false
},
output: {

@@ -14,10 +8,6 @@ library: 'expect',

plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
]
node: {
buffer: false
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc