@opra/testing 1.0.0-alpha.9 → 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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.convertFilter = exports.ApiExpectCollection = void 0;
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;
@@ -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 http_1.Server ? app : (0, http_1.createServer)(app);
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 = void 0;
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');
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1,6 +1,6 @@
1
+ import { createServer, Server } from 'node:http';
1
2
  import * as path from 'node:path';
2
3
  import { FetchBackend, HttpResponse } from '@opra/client';
3
- import { createServer, Server } from 'http';
4
4
  import { ApiExpect } from './api-expect/api-expect.js';
5
5
  /**
6
6
  *
@@ -1,4 +1,4 @@
1
- import { HttpClientBase, kBackend } from '@opra/client';
1
+ import { HttpClientBase } from '@opra/client';
2
2
  import { TestBackend } from './test-backend.js';
3
3
  export const kContext = Symbol.for('kContext');
4
4
  export class OpraTestClient extends HttpClientBase {
package/package.json CHANGED
@@ -1,44 +1,41 @@
1
1
  {
2
2
  "name": "@opra/testing",
3
- "version": "1.0.0-alpha.9",
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-r3",
32
- "@opra/client": "^1.0.0-alpha.9",
33
- "@opra/common": "^1.0.0-alpha.9",
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
- "module": "./esm/index.js",
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
+ }
@@ -1,5 +1,5 @@
1
1
  import '../jest-extend/index.js';
2
- import { ErrorIssue } from '@opra/common';
2
+ import { type ErrorIssue } from '@opra/common';
3
3
  import { ApiExpectBase } from './api-expect-base.js';
4
4
  export interface MatchingErrorIssue {
5
5
  message?: ErrorIssue['message'] | RegExp;
@@ -0,0 +1,2 @@
1
+ import './jest-extend/index.js';
2
+ export * from './test-client.js';
@@ -1,6 +1,5 @@
1
- /// <reference types="node" />
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;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { FetchBackend, HttpClientBase, kBackend } from '@opra/client';
3
2
  import { IncomingMessage, Server, ServerResponse } from 'http';
4
3
  import { ApiExpect } from './api-expect/api-expect.js';