tinyexpect 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.gitattributes CHANGED
File without changes
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/index.js CHANGED
@@ -6,10 +6,11 @@ function expect(v) {
6
6
  toBe: (a) => {
7
7
  if (typeof v === "object") {
8
8
  if (JSON.stringify(v) !== JSON.stringify(a)) {
9
+ console.error(`Expected ${JSON.stringify(v, null, 2)} to be ${JSON.stringify(a, null, 2)}`);
9
10
  throw new Error(`Objects are not equal`);
10
11
  }
11
12
  }
12
- if (v !== a) {
13
+ else if (v !== a) {
13
14
  throw new Error(`Expected ${v} to be ${a}`);
14
15
  }
15
16
  },
package/index.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  export function expect(v: any) {
2
2
  return {
3
3
  toBe: (a: any) => {
4
- if (typeof v === "object"){
5
- if (JSON.stringify(v) !== JSON.stringify(a)){
6
- throw new Error(`Objects are not equal`)
7
- }
8
- }
9
- if (v !== a) {
10
- throw new Error(`Expected ${v} to be ${a}`)
11
- }
4
+ if (typeof v === "object") {
5
+ if (JSON.stringify(v) !== JSON.stringify(a)) {
6
+ console.error(`Expected ${JSON.stringify(v,null,2)} to be ${JSON.stringify(a,null,2)}`);
7
+ throw new Error(`Objects are not equal`);
8
+ }
9
+ } else if (v !== a) {
10
+ throw new Error(`Expected ${v} to be ${a}`);
11
+ }
12
12
  },
13
13
  eitherOr: (values: any[]) => {
14
14
  if (!values.includes(v)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinyexpect",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "keywords": [
14
14
  "expect"
15
15
  ],
16
- "author": "Mak Drakos",
16
+ "author": "crafter999",
17
17
  "license": "MIT",
18
18
  "bugs": {
19
19
  "url": "https://github.com/crafter999/tinyexpect/issues"
package/tsconfig.json CHANGED
File without changes