Skip to content

Commit 1187e22

Browse files
committed
feat: initial implementation of test utility
1 parent 8efd23f commit 1187e22

File tree

4 files changed

+91
-1
lines changed

4 files changed

+91
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,49 @@
1-
# Test
1+
# Test #
2+
3+
Simple Test utility.
4+
5+
### Script
6+
7+
__`test/test.js`__
8+
9+
```js
10+
import Test from "@jlongyam/test";
11+
12+
// Only 4 keywords
13+
const { describe, it, assert, run } = Test();
14+
15+
describe("Test", () => { // Container
16+
it("should 5", () => { // Section
17+
assert(2+3 === 5); // True
18+
});
19+
it("should 4", () => {
20+
assert(-1+5 === 5); // False
21+
});
22+
it("should 0", () => {
23+
assert(0+0 === 0);
24+
});
25+
});
26+
27+
run(); // Report
28+
```
29+
30+
__`package.json`__:
31+
32+
```JSON
33+
"scripts": {
34+
"test": "node ./test/test.js"
35+
}
36+
```
37+
38+
### Terminal
39+
40+
```shell
41+
npm test
42+
```
43+
44+
```shell
45+
Test
46+
✔ should 5
47+
✖ should 4 - Failed
48+
✔ should 0
49+
```

package.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "@jlongyam/test",
3+
"version": "0.1.0",
4+
"description": "Simple Test utility ",
5+
"keywords": [
6+
"test",
7+
"simple"
8+
],
9+
"homepage": "https://github.com/jlongyam/Test#readme",
10+
"bugs": {
11+
"url": "https://github.com/jlongyam/Test/issues"
12+
},
13+
"repository": {
14+
"type": "git",
15+
"url": "git+https://github.com/jlongyam/Test.git"
16+
},
17+
"license": "MIT",
18+
"author": "jlongyam",
19+
"type": "module",
20+
"main": "./src/Test.js",
21+
"scripts": {
22+
"test": "node ./test/test.js"
23+
}
24+
}

test/test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import Test from "../src/Test.js";
2+
3+
const { describe, it, assert, run } = Test();
4+
5+
describe("Test", () => {
6+
it("should 5", () => {
7+
assert(2+3 === 5);
8+
});
9+
it("should 4", () => {
10+
assert(-1+5 === 5);
11+
});
12+
it("should 0", () => {
13+
assert(0+0 === 0);
14+
});
15+
});
16+
17+
run();

0 commit comments

Comments
 (0)