Skip to content

Commit cca5ac9

Browse files
committed
monorepo tests enablement
1 parent 2d356cb commit cca5ac9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+145
-166
lines changed

core/deno.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"./unsafe_tests/**/*"
1212
]
1313
},
14+
"tasks": {
15+
"clean": "rm -rf ./lib ./cjs ./esm"
16+
},
1417
"imports": {
1518
"@nats-io/nkeys": "jsr:@nats-io/[email protected]",
1619
"@nats-io/nuid": "jsr:@nats-io/[email protected]"

core/src/core.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,14 @@ export interface Server {
341341
tlsName: string;
342342

343343
resolve(
344-
opts: Partial<{ fn: DnsResolveFn; randomize: boolean; debug?: boolean, resolve?: boolean }>,
344+
opts: Partial<
345+
{
346+
fn: DnsResolveFn;
347+
randomize: boolean;
348+
debug?: boolean;
349+
resolve?: boolean;
350+
}
351+
>,
345352
): Promise<Server[]>;
346353
}
347354

@@ -1050,11 +1057,11 @@ export interface ConnectionOptions {
10501057
noAsyncTraces?: boolean;
10511058

10521059
/**
1053-
* When false, the connect function will not perform any hostname resolution. Note that
1054-
* by default this option will be true if the client supports hostname resolution.
1055-
* Note that on clients that don't supported (mainly the websocket client, setting this
1056-
* option to true, will throw an exception as this option is not available.
1057-
*/
1060+
* When false, the connect function will not perform any hostname resolution. Note that
1061+
* by default this option will be true if the client supports hostname resolution.
1062+
* Note that on clients that don't supported (mainly the websocket client, setting this
1063+
* option to true, will throw an exception as this option is not available.
1064+
*/
10581065
resolve?: boolean;
10591066
}
10601067

core/src/internal_mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export { Nuid, nuid } from "./nuid.ts";
44
export type { TypedSubscriptionOptions } from "./types.ts";
55

66
export { MsgImpl } from "./msg.ts";
7-
export { setTransportFactory, getResolveFn } from "./transport.ts";
7+
export { getResolveFn, setTransportFactory } from "./transport.ts";
88
export type { Transport, TransportFactory } from "./transport.ts";
99
export { Connect, INFO, ProtocolHandler } from "./protocol.ts";
1010
export type { Backoff, Deferred, Delay, Perf, Timeout } from "./util.ts";

core/src/protocol.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ export class ProtocolHandler implements Dispatcher<ParserEvent> {
594594
fn: getResolveFn(),
595595
debug: this.options.debug,
596596
randomize: !this.options.noRandomize,
597-
resolve
597+
resolve,
598598
});
599599

600600
let lastErr: Error | null = null;

core/tests/auth_test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import {
16-
_setup,
17-
assertErrorCode,
18-
cleanup,
19-
NatsServer,
20-
} from "../../test_helpers/mod.ts";
15+
import { _setup, assertErrorCode, cleanup, NatsServer } from "test_helpers";
2116
import {
2217
assert,
2318
assertArrayIncludes,

core/tests/authenticator_test.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
16+
import { _setup, cleanup } from "test_helpers";
1717
import { connect } from "./connect.ts";
1818

1919
import {
@@ -28,7 +28,12 @@ import {
2828
tokenAuthenticator,
2929
usernamePasswordAuthenticator,
3030
} from "../src/internal_mod.ts";
31-
import type { NatsConnectionImpl, Auth, Authenticator, NatsConnection } from "../src/internal_mod.ts";
31+
import type {
32+
Auth,
33+
Authenticator,
34+
NatsConnection,
35+
NatsConnectionImpl,
36+
} from "../src/internal_mod.ts";
3237

3338
import { assertEquals } from "jsr:@std/assert";
3439
import {
@@ -37,7 +42,7 @@ import {
3742
encodeUser,
3843
fmtCreds,
3944
} from "jsr:@nats-io/[email protected]";
40-
import { assertBetween } from "../../test_helpers/mod.ts";
45+
import { assertBetween } from "test_helpers";
4146

4247
function disconnectReconnect(nc: NatsConnection): Promise<void> {
4348
const done = deferred<void>();

core/tests/autounsub_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { assert, assertEquals } from "jsr:@std/assert";
1616

1717
import { createInbox, Empty, ErrorCode } from "../src/internal_mod.ts";
1818
import type { NatsConnectionImpl, Subscription } from "../src/internal_mod.ts";
19-
import { _setup, cleanup, Lock } from "../../test_helpers/mod.ts";
19+
import { _setup, cleanup, Lock } from "test_helpers";
2020
import { connect } from "./connect.ts";
2121

2222
Deno.test("autounsub - max option", async () => {

core/tests/basics_test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ import type {
4545
Msg,
4646
MsgHdrs,
4747
NatsConnectionImpl,
48+
NatsError,
4849
Payload,
4950
Publisher,
5051
PublishOptions,
5152
SubscriptionImpl,
52-
NatsError,
5353
} from "../src/internal_mod.ts";
5454
import {
5555
_setup,
@@ -58,7 +58,7 @@ import {
5858
disabled,
5959
Lock,
6060
NatsServer,
61-
} from "../../test_helpers/mod.ts";
61+
} from "test_helpers";
6262
import { connect } from "./connect.ts";
6363

6464
Deno.test("basics - connect port", async () => {
@@ -1207,7 +1207,7 @@ Deno.test("basics - msg typed payload", async () => {
12071207
const nc = await connect({ port: ns.port });
12081208

12091209
nc.subscribe("echo", {
1210-
callback: (_err: Error|null, msg: Msg) => {
1210+
callback: (_err: Error | null, msg: Msg) => {
12111211
msg.respond(msg.data);
12121212
},
12131213
});
@@ -1423,12 +1423,11 @@ Deno.test("basics - respond message", async () => {
14231423
await cleanup(ns, nc);
14241424
});
14251425

1426-
14271426
Deno.test("basics - resolve", async () => {
14281427
const token = Deno.env.get("NGS_CI_USER");
14291428
if (token === undefined) {
14301429
disabled(
1431-
`skipping: NGS_CI_USER is not available in the environment`,
1430+
`skipping: NGS_CI_USER is not available in the environment`,
14321431
);
14331432
return;
14341433
}

core/tests/binary_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import { assertEquals } from "jsr:@std/assert";
1717
import { createInbox, deferred } from "../src/internal_mod.ts";
1818
import type { Msg } from "../src/internal_mod.ts";
19-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
19+
import { _setup, cleanup } from "test_helpers";
2020
import { connect } from "./connect.ts";
2121

2222
function macro(input: Uint8Array) {

core/tests/buffer_test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@
88
// in a browser environment
99

1010
import { assert, assertEquals, assertThrows } from "jsr:@std/assert";
11-
import { DenoBuffer, MAX_SIZE, readAll, writeAll } from "../src/internal_mod.ts";
11+
import {
12+
DenoBuffer,
13+
MAX_SIZE,
14+
readAll,
15+
writeAll,
16+
} from "../src/internal_mod.ts";
1217

1318
// N controls how many iterations of certain checks are performed.
1419
const N = 100;

core/tests/disconnect_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
import { connect } from "./connect.ts";
17-
import { Lock, NatsServer } from "../../test_helpers/mod.ts";
17+
import { Lock, NatsServer } from "test_helpers";
1818
import type { NatsConnectionImpl } from "../src/internal_mod.ts";
1919

2020
Deno.test("disconnect - close handler is called on close", async () => {

core/tests/drain_test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,14 @@
1313
* limitations under the License.
1414
*/
1515
import { assert, assertEquals, fail } from "jsr:@std/assert";
16-
import {
17-
createInbox,
18-
ErrorCode,
19-
StringCodec,
20-
} from "../src/internal_mod.ts";
16+
import { createInbox, ErrorCode, StringCodec } from "../src/internal_mod.ts";
2117
import type { Msg } from "../src/internal_mod.ts";
2218
import {
2319
assertThrowsAsyncErrorCode,
2420
assertThrowsErrorCode,
2521
Lock,
26-
} from "../../test_helpers/mod.ts";
27-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
22+
} from "test_helpers";
23+
import { _setup, cleanup } from "test_helpers";
2824
import { connect } from "./connect.ts";
2925

3026
Deno.test("drain - connection drains when no subs", async () => {

core/tests/events_test.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import { Lock, NatsServer, ServerSignals } from "../../test_helpers/mod.ts";
15+
import { Lock, NatsServer, ServerSignals } from "test_helpers";
1616
import { connect } from "./connect.ts";
1717
import { assertEquals } from "jsr:@std/assert";
18-
import { delay, Events } from "../src/internal_mod.ts";
19-
import type { NatsConnectionImpl, ServersChanged } from "../src/internal_mod.ts";
20-
import { _setup } from "../../test_helpers/mod.ts";
18+
import { delay, Events } from "../src/internal_mod.ts";
19+
import type {
20+
NatsConnectionImpl,
21+
ServersChanged,
22+
} from "../src/internal_mod.ts";
23+
import { _setup } from "test_helpers";
2124

2225
Deno.test("events - close on close", async () => {
2326
const { ns, nc } = await _setup(connect);

core/tests/headers_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import type {
3333
import { NatsServer } from "../../test_helpers/launcher.ts";
3434
import { assert, assertEquals, assertThrows } from "jsr:@std/assert";
3535
import { TestDispatcher } from "./parser_test.ts";
36-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
36+
import { _setup, cleanup } from "test_helpers";
3737

3838
Deno.test("headers - illegal key", () => {
3939
const h = headers();

core/tests/heartbeats_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
delay,
2121
Heartbeat,
2222
} from "../src/internal_mod.ts";
23-
import type { Status, PH } from "../src/internal_mod.ts";
23+
import type { PH, Status } from "../src/internal_mod.ts";
2424

2525
function pm(
2626
lag: number,

core/tests/iterators_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
import { connect } from "./connect.ts";
1616
import { assert, assertEquals, assertRejects } from "jsr:@std/assert";
17-
import { assertErrorCode, Lock, NatsServer } from "../../test_helpers/mod.ts";
17+
import { assertErrorCode, Lock, NatsServer } from "test_helpers";
1818
import {
1919
createInbox,
2020
delay,
@@ -24,7 +24,7 @@ import {
2424
syncIterator,
2525
} from "../src/internal_mod.ts";
2626
import type { NatsConnectionImpl } from "../src/internal_mod.ts";
27-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
27+
import { _setup, cleanup } from "test_helpers";
2828

2929
Deno.test("iterators - unsubscribe breaks and closes", async () => {
3030
const { ns, nc } = await _setup(connect);

core/tests/json_test.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
*/
1515
import { connect } from "./connect.ts";
1616
import { assertEquals } from "jsr:@std/assert";
17-
import {
18-
createInbox,
19-
ErrorCode,
20-
JSONCodec,
21-
} from "../src/internal_mod.ts";
17+
import { createInbox, ErrorCode, JSONCodec } from "../src/internal_mod.ts";
2218
import type { Msg, NatsError } from "../src/internal_mod.ts";
23-
import { Lock } from "../../test_helpers/mod.ts";
19+
import { Lock } from "test_helpers";
2420
import { assertThrowsErrorCode } from "../../test_helpers/asserts.ts";
25-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
21+
import { _setup, cleanup } from "test_helpers";
2622

2723
Deno.test("json - bad json error in callback", () => {
2824
const o = {};

core/tests/mrequest_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* See the License for the specific language governing permissions and
1313
* limitations under the License.
1414
*/
15-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
15+
import { _setup, cleanup } from "test_helpers";
1616
import { connect } from "./connect.ts";
1717
import type { NatsConnectionImpl } from "../src/internal_mod.ts";
1818
import {

core/tests/noresponders_test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,8 @@
1414
*/
1515

1616
import { connect } from "./connect.ts";
17-
import {
18-
createInbox,
19-
Empty,
20-
ErrorCode,
21-
headers,
22-
} from "@nats-io/nats-core";
23-
import { assertErrorCode, Lock, NatsServer } from "../../test_helpers/mod.ts";
17+
import { createInbox, Empty, ErrorCode, headers } from "@nats-io/nats-core";
18+
import { assertErrorCode, Lock, NatsServer } from "test_helpers";
2419
import { assert, assertEquals, fail } from "jsr:@std/assert";
2520

2621
Deno.test("noresponders - option", async () => {

core/tests/protocol_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
Subscriptions,
2424
} from "../src/internal_mod.ts";
2525
import type { Msg, ProtocolHandler } from "../src/internal_mod.ts";
26-
import { assertErrorCode } from "../../test_helpers/mod.ts";
26+
import { assertErrorCode } from "test_helpers";
2727
import { assertEquals, equal } from "jsr:@std/assert";
2828

2929
Deno.test("protocol - mux subscription unknown return null", async () => {

core/tests/queues_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { createInbox } from "../src/internal_mod.ts";
1717
import type { Subscription } from "../src/internal_mod.ts";
1818
import { assertEquals } from "jsr:@std/assert";
1919
import { connect } from "./connect.ts";
20-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
20+
import { _setup, cleanup } from "test_helpers";
2121

2222
Deno.test("queues - deliver to single queue", async () => {
2323
const { ns, nc } = await _setup(connect);

core/tests/reconnect_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
import { assert, assertEquals, fail } from "jsr:@std/assert";
1616
import { connect } from "./connect.ts";
17-
import { assertErrorCode, Lock, NatsServer } from "../../test_helpers/mod.ts";
17+
import { assertErrorCode, Lock, NatsServer } from "test_helpers";
1818
import {
1919
createInbox,
2020
DataBuffer,
@@ -27,7 +27,7 @@ import {
2727
} from "../src/internal_mod.ts";
2828
import type { NatsConnectionImpl, NatsError } from "../src/internal_mod.ts";
2929

30-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
30+
import { _setup, cleanup } from "test_helpers";
3131
import { deadline } from "jsr:@std/async";
3232

3333
Deno.test("reconnect - should receive when some servers are invalid", async () => {

core/tests/resub_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515

1616
import { connect } from "./connect.ts";
17-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
17+
import { _setup, cleanup } from "test_helpers";
1818
import { createInbox } from "../src/internal_mod.ts";
1919
import type {
2020
Msg,

core/tests/semver_test.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
* limitations under the License.
1414
*/
1515

16-
import { compare, Feature, Features, parseSemVer } from "../src/internal_mod.ts";
16+
import {
17+
compare,
18+
Feature,
19+
Features,
20+
parseSemVer,
21+
} from "../src/internal_mod.ts";
1722
import {
1823
assert,
1924
assertEquals,

core/tests/sub_extensions_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import { assert, assertEquals } from "jsr:@std/assert";
1616
import { createInbox, deferred, StringCodec } from "../src/internal_mod.ts";
1717
import type { Msg, SubscriptionImpl } from "../src/internal_mod.ts";
1818
import { connect } from "./connect.ts";
19-
import { _setup, cleanup } from "../../test_helpers/mod.ts";
19+
import { _setup, cleanup } from "test_helpers";
2020

2121
Deno.test("extensions - cleanup fn called at auto unsub", async () => {
2222
const { ns, nc } = await _setup(connect);

core/tests/tls_test.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ import {
2121
import { connect } from "./connect.ts";
2222
import { ErrorCode } from "../src/internal_mod.ts";
2323
import type { NatsConnectionImpl } from "../src/internal_mod.ts";
24-
import {
25-
assertErrorCode,
26-
cleanup,
27-
Lock,
28-
NatsServer,
29-
} from "../../test_helpers/mod.ts";
24+
import { assertErrorCode, cleanup, Lock, NatsServer } from "test_helpers";
3025

3126
Deno.test("tls - fail if server doesn't support TLS", async () => {
3227
const ns = await NatsServer.start();

0 commit comments

Comments
 (0)