Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"lint-staged": "^17.0.5",
"prettier": "^3.5.3",
"tsx": "^4.19.3",
"typescript": "^5.7.3",
"typescript": "^6.0.3",
"typescript-eslint": "^8.25.0",
"undici": "^7.4.0"
"undici": "^8.10.0"
},
"lint-staged": {
"*.{js,jsx}": "eslint --cache --fix"
Expand Down
15 changes: 14 additions & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, before, afterEach, mock, describe, it } from 'node:test'
import { MockAgent, setGlobalDispatcher } from 'undici'
import { MockAgent, install, setGlobalDispatcher } from 'undici'
import assert from 'node:assert'
import {
MOCK_CONFIG,
Expand All @@ -14,10 +14,23 @@ describe('NetSuiteClient.get', () => {

beforeEach(() => {
agent = new MockAgent()
// Turn an unmatched request into an explicit MockNotMatchedError instead of
// a live call. Note this only covers requests that reach MockAgent's
// interceptor layer; it does not catch a dispatcher-level bypass like the
// one described in the before() hook below.
agent.disableNetConnect()
setGlobalDispatcher(agent)
})

before(async () => {
// Route globalThis.fetch through undici's own fetch so that MockAgent can
// intercept it. Node's built-in fetch reaches the global dispatcher through
// a wrapper that forces `allowH2: false`, which from undici 8.0.3 makes the
// agent look up an `<origin>#http1-only` client key that MockAgent never
// registers -- the request then escapes to the real network. See
// nodejs/undici#5036; the fix is merged but unreleased as of undici 8.10.0.
install()

mock.module('jsrsasign', {
namedExports: {
KJUR: {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/cjs",
"tsBuildInfoFile": "./dist/cjs/tsconfig.cjs.tsbuildinfo",
"module": "CommonJS",
"declaration": true
}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./dist/esm",
"tsBuildInfoFile": "./dist/esm/tsconfig.esm.tsbuildinfo",
"module": "ESNext",
"declaration": true
}
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/* Modules */
"module": "ESNext" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
"rootDir": "./src" /* Specify the root folder within your source files. */,
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
Expand Down
Loading