Repository: unexpectedjs/unexpected (js)

Issue:
Accept "not to be defined" (equivalent to "to be undefined")
Occasionally I write `"not to be defined"`, and run my tests, then remember that I need to phrase it `"to be undefined"`.  It would be nice if Unexpected accepted either one (with both meaning the same thing).

Pull request description:
Allow "not to be defined" to check for undefined.
Closes #649

Patch:
diff --git a/documentation/assertions/any/to-be-defined.md b/documentation/assertions/any/to-be-defined.md
index 668592e3..8a0b2a51 100644
--- a/documentation/assertions/any/to-be-defined.md
+++ b/documentation/assertions/any/to-be-defined.md
@@ -5,6 +5,12 @@ expect('Hello world!', 'to be defined');
 expect({ foo: { bar: 'baz' } }, 'to be defined');
 ```
 
+This assertion can be negated using the `not` flag:
+
+```js
+expect(undefined, 'not to be defined');
+```
+
 In case of a failing expectation you get the following output:
 
 ```js
diff --git a/lib/assertions.js b/lib/assertions.js
index 9f82a321..0a23eb94 100644
--- a/lib/assertions.js
+++ b/lib/assertions.js
@@ -77,8 +77,8 @@ module.exports = expect => {
     expect(typeof subject === 'undefined', '[not] to be truthy');
   });
 
-  expect.addAssertion('<any> to be defined', (expect, subject) => {
-    expect(subject, 'not to be undefined');
+  expect.addAssertion('<any> [not] to be defined', (expect, subject) => {
+    expect(subject, '[!not] to be undefined');
   });
 
   expect.addAssertion('<number|NaN> [not] to be NaN', (expect, subject) => {


Test patch:
diff --git a/test/assertions/to-be.spec.js b/test/assertions/to-be.spec.js
index de616063..c450e1fa 100644
--- a/test/assertions/to-be.spec.js
+++ b/test/assertions/to-be.spec.js
@@ -15,6 +15,7 @@ describe('to be assertion', () => {
     expect(false, 'not to be true');
     expect(false, 'to be false');
     expect(true, 'not to be false');
+    expect(undefined, 'not to be defined');
     expect(undefined, 'to be undefined');
     expect(false, 'to be defined');
     expect({}, 'to be defined');