beartest-js 4.0.0 → 5.0.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/README.md +16 -8
- package/{beartest.cjs → beartest.js} +0 -0
- package/index.js +1 -0
- package/package.json +2 -3
- package/testrunner.js +4 -4
- package/index.cjs +0 -1
package/README.md
CHANGED
|
@@ -18,24 +18,24 @@ Jest, Mocha, and similar testing frameworks are richly featured, broadly compati
|
|
|
18
18
|
|
|
19
19
|
### Compatibility
|
|
20
20
|
|
|
21
|
-
The Beartest test runner uses
|
|
21
|
+
The Beartest test runner uses common js to load files.
|
|
22
22
|
|
|
23
23
|
### Usage
|
|
24
24
|
|
|
25
|
-
_Beartest_ implements the following functions `describe`, `it`, `beforeAll`, `beforeEach`, `afterEach`, `afterAll`, `it.skip`, and `it.only`.
|
|
25
|
+
_Beartest_ implements the following functions `describe`, `it`, `beforeAll`, `beforeEach`, `afterEach`, `afterAll`, `it.skip`, and `it.only`. All provided functions work in a similar way as the corresponding functions in Jest.
|
|
26
26
|
|
|
27
27
|
### Example
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
import { describe, it } from
|
|
31
|
-
import assert from
|
|
30
|
+
import { describe, it } from "beartest-js";
|
|
31
|
+
import assert from "assert";
|
|
32
32
|
|
|
33
|
-
describe(
|
|
34
|
-
it(
|
|
33
|
+
describe("Math Testing", () => {
|
|
34
|
+
it("should add correctly", async () => {
|
|
35
35
|
assert.strictEqual(1 + 2, 3);
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
-
it(
|
|
38
|
+
it("should subtract correctly", async () => {
|
|
39
39
|
assert.strictEqual(3 - 2, 1);
|
|
40
40
|
});
|
|
41
41
|
});
|
|
@@ -43,7 +43,15 @@ describe('Math Testing', () => {
|
|
|
43
43
|
|
|
44
44
|
### Running Tests
|
|
45
45
|
|
|
46
|
-
Additionally, a very basic test runner is included. This test runner accepts a glob pattern as a command line argument. The test runner can be invoked with `beartest "glob-pattern"`.
|
|
46
|
+
Additionally, a very basic test runner is included. This test runner accepts a glob pattern as a command line argument. The test runner can be invoked with `yarn beartest "glob-pattern"`. By default, it will look for `**/*.test.js`.
|
|
47
|
+
|
|
48
|
+
Suggested package script:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
"scripts": {
|
|
52
|
+
"test": "beartest"
|
|
53
|
+
}
|
|
54
|
+
```
|
|
47
55
|
|
|
48
56
|
## License
|
|
49
57
|
|
|
File without changes
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require("./beartest");
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beartest-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"description": "Bear Bones Testing",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/rubber-duck-software/beartest.git"
|
|
8
8
|
},
|
|
9
9
|
"types": "index.d.ts",
|
|
10
|
-
"
|
|
10
|
+
"main": "index.js",
|
|
11
11
|
"bin": {
|
|
12
12
|
"beartest": "testrunner.js"
|
|
13
13
|
},
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"url": "https://github.com/rubber-duck-software/beartest/issues"
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://github.com/rubber-duck-software/beartest#readme",
|
|
25
|
-
"main": "index.cjs",
|
|
26
25
|
"devDependencies": {},
|
|
27
26
|
"scripts": {
|
|
28
27
|
"test": "echo \"Error: no test specified\" && exit 1"
|
package/testrunner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const beartest = require("./beartest");
|
|
3
|
+
const glob = require("tiny-glob");
|
|
4
4
|
|
|
5
5
|
const tests = [];
|
|
6
6
|
const describe = beartest.describe;
|
|
@@ -8,10 +8,10 @@ beartest.describe = (headline, fn) => tests.push(describe(headline, fn));
|
|
|
8
8
|
|
|
9
9
|
async function runTests() {
|
|
10
10
|
try {
|
|
11
|
-
const globStr = process.argv[2] ||
|
|
11
|
+
const globStr = process.argv[2] || "**/*.test.*";
|
|
12
12
|
const files = await glob(globStr, { absolute: true });
|
|
13
13
|
for (const file of files) {
|
|
14
|
-
|
|
14
|
+
require(file);
|
|
15
15
|
await Promise.all(tests);
|
|
16
16
|
}
|
|
17
17
|
process.exit(0);
|
package/index.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./beartest.cjs');
|