@locustjs/test 1.4.0 → 1.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@locustjs/test",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "This library provides a simple test runner.",
5
5
  "main": "index.cjs.js",
6
6
  "module": "index.esm.js",
@@ -14,6 +14,10 @@
14
14
  },
15
15
  "keywords": [
16
16
  "locustjs",
17
+ "unit test",
18
+ "unit testing",
19
+ "tdd",
20
+ "test",
17
21
  "test runner"
18
22
  ],
19
23
  "author": "Iron Code",
@@ -23,6 +27,7 @@
23
27
  },
24
28
  "homepage": "https://github.com/ironcodev/locustjs-test#readme",
25
29
  "dependencies": {
30
+ "@babel/preset-env": "^7.24.7",
26
31
  "@locustjs/base": "^4.0.0",
27
32
  "@locustjs/exception": "^2.0.2"
28
33
  },
package/tests/index.js CHANGED
@@ -25,8 +25,8 @@ const tests = [
25
25
  .toBeOfType("number");
26
26
 
27
27
  expect(n)
28
- .toBeValid(x => x > 2)
29
- .notToBeValid(x => x < 2);
28
+ .toBeValid((x) => x > 2)
29
+ .notToBeValid((x) => x < 2);
30
30
  },
31
31
  ],
32
32
  [
@@ -48,10 +48,7 @@ const tests = [
48
48
  function (expect) {
49
49
  const n = [];
50
50
 
51
- expect(n)
52
- .toBeDefined()
53
- .toBeArray()
54
- .toBeEmptyArray();
51
+ expect(n).toBeDefined().toBeArray().toBeEmptyArray();
55
52
  },
56
53
  ],
57
54
  [
@@ -59,10 +56,7 @@ const tests = [
59
56
  function (expect) {
60
57
  const n = [10];
61
58
 
62
- expect(n)
63
- .toBeDefined()
64
- .toBeArray()
65
- .toBeSomeArray();
59
+ expect(n).toBeDefined().toBeArray().toBeSomeArray();
66
60
  },
67
61
  ],
68
62
  [
@@ -82,7 +76,7 @@ const tests = [
82
76
  [
83
77
  "Test 6: object",
84
78
  function (expect) {
85
- const n = {a:10};
79
+ const n = { a: 10 };
86
80
 
87
81
  expect(n)
88
82
  .toBeDefined()
@@ -101,8 +95,15 @@ const tests = [
101
95
  expect(x).toBeGreaterThan(20);
102
96
  },
103
97
  ],
98
+ ["Test 8: not expected", function (expect) {}],
104
99
  [
105
- "Test 8: class",
100
+ "Test 9: error without expect",
101
+ function (expect) {
102
+ throw "some err";
103
+ },
104
+ ],
105
+ [
106
+ "Test 10: class",
106
107
  function (expect) {
107
108
  const x = new Bar();
108
109
 
@@ -114,7 +115,7 @@ const tests = [
114
115
  .toBeInstanceOf(Foo)
115
116
  .notToBeInstanceOf(Buz);
116
117
  },
117
- ]
118
+ ],
118
119
  ];
119
120
 
120
121
  TestRunner.start(tests);