@pezkuwi/dev-test 0.84.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/.skip-deno +0 -0
- package/README.md +32 -0
- package/package.json +30 -0
- package/tsconfig.build.json +16 -0
- package/tsconfig.spec.json +16 -0
package/.skip-deno
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @pezkuwi/dev-test
|
|
2
|
+
|
|
3
|
+
This is a very basic Jest-compatible environment that could be used alongside tests. The need for this came from replacing Jest with `node --test` without rewriting all assertions.
|
|
4
|
+
|
|
5
|
+
It provides the following -
|
|
6
|
+
|
|
7
|
+
1. Browser `window`, `document`, `navigator` (see usage for browser-specific path)
|
|
8
|
+
2. `jest` functions, specifically `spyOn` (not comprehensive, some will error, some witll noop)
|
|
9
|
+
3. `expect` functions (not comprehensive, caters for specific polkadot-js usage)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
On thing to note is that `node:test` is still rapidly evolving - this includes the APIs and features. As such this requires at least Node 18.14, however 18.15+ is recommended.
|
|
15
|
+
|
|
16
|
+
The entry points are different based on the environment you would like to operate in. For a browser-like environment,
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
node --require @pezkuwi/dev-test/browser ...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or for a basic describe/expect/jest-only global environment
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
node --require @pezkuwi/dev-test/node ...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The `...` above indicates any additional Node options, for instance a full command could be -
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
node --require @pezkuwi/dev-test/node --test something.test.js
|
|
32
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "Jaco Greeff <jacogr@gmail.com>",
|
|
3
|
+
"bugs": "https://github.com/pezkuwi/dev/issues",
|
|
4
|
+
"description": "A basic test-functions-as-global library on top of node:test",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18.14"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/pezkuwi/dev/tree/master/packages/dev-test#readme",
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"name": "@pezkuwi/dev-test",
|
|
11
|
+
"repository": {
|
|
12
|
+
"directory": "packages/dev-test",
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/pezkuwi/dev.git"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"type": "module",
|
|
18
|
+
"version": "0.84.2",
|
|
19
|
+
"main": "./index.js",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./globals.d.ts": "./src/globals.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"jsdom": "^24.0.0",
|
|
25
|
+
"tslib": "^2.7.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/jsdom": "^21.1.6"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "..",
|
|
5
|
+
"outDir": "./build",
|
|
6
|
+
"rootDir": "./src"
|
|
7
|
+
},
|
|
8
|
+
"exclude": [
|
|
9
|
+
"**/mod.ts",
|
|
10
|
+
"src/**/*.spec.ts"
|
|
11
|
+
],
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*"
|
|
14
|
+
],
|
|
15
|
+
"references": []
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "..",
|
|
5
|
+
"outDir": "./build",
|
|
6
|
+
"rootDir": "./src",
|
|
7
|
+
"emitDeclarationOnly": false,
|
|
8
|
+
"noEmit": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"src/**/*.spec.ts"
|
|
12
|
+
],
|
|
13
|
+
"references": [
|
|
14
|
+
{ "path": "../dev-test/tsconfig.build.json" }
|
|
15
|
+
]
|
|
16
|
+
}
|