fix(rpc-provider)!: move nock to devDependencies so it no longer ships (#6266)

* fix(rpc-provider): move nock to devDependencies so it no longer ships

* Remove mock-socket from prod deps
This commit is contained in:
Tarik Gul
2026-07-19 04:52:00 +03:00
committed by GitHub
parent 5f94aa34dd
commit 833adeb724
14 changed files with 43 additions and 35 deletions
+3 -3
View File
@@ -30,12 +30,12 @@
"@polkadot/x-global": "^14.0.3",
"@polkadot/x-ws": "^14.0.3",
"eventemitter3": "^5.0.1",
"mock-socket": "^9.3.1",
"nock": "^13.5.5",
"tslib": "^2.8.1"
},
"devDependencies": {
"@substrate/connect": "0.8.11"
"@substrate/connect": "0.8.11",
"mock-socket": "^9.3.1",
"nock": "^13.5.5"
},
"optionalDependencies": {
"@substrate/connect": "0.8.11"
+1 -1
View File
@@ -3,7 +3,7 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import { TEST_HTTP_URL } from '../mock/mockHttp.js';
import { TEST_HTTP_URL } from '../mock/mockHttp.manual.js';
import { HttpProvider } from './index.js';
describe('Http', (): void => {
+2 -2
View File
@@ -3,9 +3,9 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Mock } from '../mock/types.js';
import type { Mock } from '../mock/testTypes.manual.js';
import { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp.js';
import { mockHttp, TEST_HTTP_URL } from '../mock/mockHttp.manual.js';
import { HttpProvider } from './index.js';
// Does not work with Node 18 (native fetch)
@@ -1,7 +1,7 @@
// Copyright 2017-2026 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Mock } from './types.js';
import type { Mock } from './testTypes.manual.js';
import nock from 'nock';
@@ -0,0 +1,20 @@
// Copyright 2017-2026 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Server } from 'mock-socket';
// Test-only types used by the mock helpers (mockHttp/mockWs) and the provider
// specs. Kept in a `.manual.ts` file so the test-only `mock-socket` dependency
// stays out of the published build and out of `dependencies`.
export type Global = typeof globalThis & {
WebSocket: typeof WebSocket;
fetch: any;
}
export interface Mock {
body: Record<string, Record<string, unknown>>;
requests: number;
server: Server;
done: () => Promise<void>;
}
-14
View File
@@ -1,20 +1,6 @@
// Copyright 2017-2026 @polkadot/rpc-provider authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { Server } from 'mock-socket';
export type Global = typeof globalThis & {
WebSocket: typeof WebSocket;
fetch: any;
}
export interface Mock {
body: Record<string, Record<string, unknown>>;
requests: number;
server: Server;
done: () => Promise<void>;
}
export type MockStateSubscriptionCallback = (error: Error | null, value: any) => void;
export interface MockStateSubscription {
+2 -2
View File
@@ -3,9 +3,9 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Mock } from '../mock/types.js';
import type { Mock } from '../mock/testTypes.manual.js';
import { mockWs } from '../mock/mockWs.js';
import { mockWs } from '../mock/mockWs.manual.js';
import { WsProvider } from './index.js';
const TEST_WS_URL = 'ws://localhost-connect.spec.ts:9988';
+3 -3
View File
@@ -3,10 +3,10 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Request } from '../mock/mockWs.js';
import type { Mock } from '../mock/types.js';
import type { Request } from '../mock/mockWs.manual.js';
import type { Mock } from '../mock/testTypes.manual.js';
import { mockWs } from '../mock/mockWs.js';
import { mockWs } from '../mock/mockWs.manual.js';
import { WsProvider } from './index.js';
const TEST_WS_URL = 'ws://localhost-index.spec.ts:9977';
+3 -3
View File
@@ -3,10 +3,10 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Request } from '../mock/mockWs.js';
import type { Global, Mock } from '../mock/types.js';
import type { Request } from '../mock/mockWs.manual.js';
import type { Global, Mock } from '../mock/testTypes.manual.js';
import { mockWs } from '../mock/mockWs.js';
import { mockWs } from '../mock/mockWs.manual.js';
import { WsProvider } from './index.js';
declare const global: Global;
@@ -3,10 +3,10 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Request } from '../mock/mockWs.js';
import type { Global, Mock } from './../mock/types.js';
import type { Request } from '../mock/mockWs.manual.js';
import type { Global, Mock } from './../mock/testTypes.manual.js';
import { mockWs } from '../mock/mockWs.js';
import { mockWs } from '../mock/mockWs.manual.js';
import { WsProvider } from './index.js';
declare const global: Global;
@@ -3,10 +3,10 @@
/// <reference types="@polkadot/dev-test/globals.d.ts" />
import type { Request } from '../mock/mockWs.js';
import type { Global, Mock } from './../mock/types.js';
import type { Request } from '../mock/mockWs.manual.js';
import type { Global, Mock } from './../mock/testTypes.manual.js';
import { mockWs } from '../mock/mockWs.js';
import { mockWs } from '../mock/mockWs.manual.js';
import { WsProvider } from './index.js';
declare const global: Global;
@@ -7,6 +7,7 @@
"resolveJsonModule": true
},
"exclude": [
"**/*.manual.ts",
"**/*.spec.ts",
"**/mod.ts"
],
+1
View File
@@ -9,6 +9,7 @@
"noEmit": true
},
"include": [
"**/*.manual.ts",
"**/*.spec.ts"
],
"references": [