@opra/testing 1.0.0-alpha.8 → 1.0.0-beta.1
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/cjs/api-expect/api-expect-collection.js +2 -2
- package/cjs/test-backend.js +2 -2
- package/cjs/utils/object-matches.util.js +1 -2
- package/esm/package.json +3 -0
- package/esm/test-backend.js +1 -1
- package/esm/test-client.js +1 -1
- package/package.json +27 -30
- package/types/api-expect/api-expect-error.d.ts +1 -1
- package/types/index.d.cts +2 -0
- package/types/test-backend.d.ts +1 -2
- package/types/test-client.d.ts +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApiExpectCollection = void 0;
|
|
4
|
+
exports.convertFilter = convertFilter;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const type_is_1 = tslib_1.__importDefault(require("@browsery/type-is"));
|
|
6
7
|
const common_1 = require("@opra/common");
|
|
@@ -254,4 +255,3 @@ function convertFilter(str) {
|
|
|
254
255
|
}
|
|
255
256
|
throw new Error(`${ast.kind} is not implemented yet`);
|
|
256
257
|
}
|
|
257
|
-
exports.convertFilter = convertFilter;
|
package/cjs/test-backend.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TestBackend = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
+
const node_http_1 = require("node:http");
|
|
5
6
|
const path = tslib_1.__importStar(require("node:path"));
|
|
6
7
|
const client_1 = require("@opra/client");
|
|
7
|
-
const http_1 = require("http");
|
|
8
8
|
const api_expect_js_1 = require("./api-expect/api-expect.js");
|
|
9
9
|
/**
|
|
10
10
|
*
|
|
@@ -13,7 +13,7 @@ const api_expect_js_1 = require("./api-expect/api-expect.js");
|
|
|
13
13
|
class TestBackend extends client_1.FetchBackend {
|
|
14
14
|
constructor(app, options) {
|
|
15
15
|
super(options?.basePath ? path.join('http://tempuri.org', options.basePath) : 'http://tempuri.org', options);
|
|
16
|
-
this._server = app instanceof
|
|
16
|
+
this._server = app instanceof node_http_1.Server ? app : (0, node_http_1.createServer)(app);
|
|
17
17
|
}
|
|
18
18
|
send(req) {
|
|
19
19
|
return new Promise((resolve, reject) => {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.objectMatches =
|
|
3
|
+
exports.objectMatches = objectMatches;
|
|
4
4
|
function objectMatches(received, expected) {
|
|
5
5
|
_objectMatches(received, expected, '');
|
|
6
6
|
}
|
|
7
|
-
exports.objectMatches = objectMatches;
|
|
8
7
|
function _objectMatches(received, expected, path) {
|
|
9
8
|
if (typeof received !== typeof expected)
|
|
10
9
|
expect(typeof received).toStrictEqual('object');
|
package/esm/package.json
ADDED
package/esm/test-backend.js
CHANGED
package/esm/test-client.js
CHANGED
package/package.json
CHANGED
|
@@ -1,44 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opra/testing",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
4
|
"description": "Opra testing package",
|
|
5
5
|
"author": "Panates",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "https://github.com/panates/opra.git",
|
|
10
|
-
"directory": "packages/testing"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"compile": "tsc",
|
|
14
|
-
"prebuild": "npm run lint && npm run clean",
|
|
15
|
-
"build": "npm run build:cjs && npm run build:esm",
|
|
16
|
-
"build:cjs": "tsc -b tsconfig-build-cjs.json",
|
|
17
|
-
"build:esm": "tsc -b tsconfig-build-esm.json",
|
|
18
|
-
"postbuild": "cp README.md package.json ../../LICENSE ../../build/testing && cp ../../package.cjs.json ../../build/testing/cjs/package.json",
|
|
19
|
-
"lint": "eslint . --max-warnings=0",
|
|
20
|
-
"lint:fix": "eslint . --max-warnings=0 --fix",
|
|
21
|
-
"format": "prettier . --write --log-level=warn",
|
|
22
|
-
"test": "jest --passWithNoTests",
|
|
23
|
-
"cover": "jest --passWithNoTests --collect-coverage",
|
|
24
|
-
"clean": "npm run clean:src && npm run clean:test && npm run clean:dist && npm run clean:cover",
|
|
25
|
-
"clean:src": "ts-cleanup -s src --all",
|
|
26
|
-
"clean:test": "ts-cleanup -s test --all",
|
|
27
|
-
"clean:dist": "rimraf ../../build/testing",
|
|
28
|
-
"clean:cover": "rimraf ../../coverage/testing"
|
|
29
|
-
},
|
|
30
7
|
"dependencies": {
|
|
31
|
-
"@browsery/type-is": "^1.6.18-
|
|
32
|
-
"@opra/client": "^1.0.0-
|
|
33
|
-
"@opra/common": "^1.0.0-
|
|
8
|
+
"@browsery/type-is": "^1.6.18-r5",
|
|
9
|
+
"@opra/client": "^1.0.0-beta.1",
|
|
10
|
+
"@opra/common": "^1.0.0-beta.1",
|
|
34
11
|
"ansi-colors": "^4.1.3",
|
|
35
12
|
"jest-matcher-utils": "^29.7.0",
|
|
36
|
-
"rule-judgment": "^1.1.5"
|
|
13
|
+
"rule-judgment": "^1.1.5",
|
|
14
|
+
"tslib": "^2.7.0"
|
|
37
15
|
},
|
|
38
16
|
"type": "module",
|
|
39
|
-
"
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": {
|
|
20
|
+
"types": "./types/index.d.ts",
|
|
21
|
+
"default": "./esm/index.js"
|
|
22
|
+
},
|
|
23
|
+
"require": {
|
|
24
|
+
"types": "./types/index.d.cts",
|
|
25
|
+
"default": "./cjs/index.js"
|
|
26
|
+
},
|
|
27
|
+
"default": "./esm/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
40
31
|
"main": "./cjs/index.js",
|
|
32
|
+
"module": "./esm/index.js",
|
|
41
33
|
"types": "./types/index.d.ts",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/panates/opra.git",
|
|
37
|
+
"directory": "packages/testing"
|
|
38
|
+
},
|
|
42
39
|
"engines": {
|
|
43
40
|
"node": ">=16.0",
|
|
44
41
|
"npm": ">=7.0.0"
|
|
@@ -55,4 +52,4 @@
|
|
|
55
52
|
"opra",
|
|
56
53
|
"testing"
|
|
57
54
|
]
|
|
58
|
-
}
|
|
55
|
+
}
|
package/types/test-backend.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { IncomingMessage, Server, ServerResponse } from 'node:http';
|
|
2
2
|
import { FetchBackend, HttpResponse } from '@opra/client';
|
|
3
|
-
import { IncomingMessage, Server, ServerResponse } from 'http';
|
|
4
3
|
import { ApiExpect } from './api-expect/api-expect.js';
|
|
5
4
|
import type { OpraTestClient } from './test-client.js';
|
|
6
5
|
declare type RequestListener = (req: IncomingMessage, res: ServerResponse) => void;
|
package/types/test-client.d.ts
CHANGED