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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
# full matrix on push; PRs test Node 24 only, for fast feedback
node: ${{ github.event_name == 'pull_request' && fromJson('[24]') || fromJson('[20, 22, 24, 26]') }}
node: ${{ github.event_name == 'pull_request' && fromJson('[24]') || fromJson('[22, 24, 26]') }}
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@
"devDependencies": {
"@release-it/conventional-changelog": "^12.0.2",
"@stylistic/eslint-plugin": "^5.10.0",
"@types/node": "^25.0.3",
"@types/node": "^26.6.2",
"@types/which": "^3.0.4",
"@vitest/coverage-v8": "^4.1.11",
"@vitest/coverage-v8": "^5.0.1",
"husky": "^9.1.7",
"npm-run-all2": "^9.0.3",
"oxlint": "^1.83.0",
"release-it": "^21.1.0",
"rimraf": "^6.1.3",
"typescript": "^6.0.3",
"vitest": "^4.1.11",
"typescript": "^7.0.2",
"vitest": "^5.0.1",
"webdriverio": "^9.32.0"
}
}
10 changes: 5 additions & 5 deletions packages/node-edgedriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"directory": "packages/node-edgedriver"
},
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
},
"type": "module",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -49,11 +49,11 @@
},
"dependencies": {
"@wdio/logger": "^9.29.1",
"@zip.js/zip.js": "^2.8.11",
"@zip.js/zip.js": "^2.16.0",
"decamelize": "^6.0.1",
"edge-paths": "^3.0.5",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6",
"which": "^6.0.1"
"http-proxy-agent": "^9.1.0",
"https-proxy-agent": "^9.1.0",
"which": "^7.0.0"
}
}
8 changes: 4 additions & 4 deletions packages/node-geckodriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
],
"engines": {
"node": ">=20.0.0"
"node": ">=22.0.0"
},
"keywords": [
"geckodriver",
Expand Down Expand Up @@ -58,10 +58,10 @@
},
"dependencies": {
"@wdio/logger": "^9.18.0",
"@zip.js/zip.js": "^2.8.11",
"@zip.js/zip.js": "^2.16.0",
"decamelize": "^6.0.1",
"http-proxy-agent": "^7.0.2",
"https-proxy-agent": "^7.0.6",
"http-proxy-agent": "^9.1.0",
"https-proxy-agent": "^9.1.0",
"modern-tar": "^0.8.5"
}
}
44 changes: 22 additions & 22 deletions packages/node-geckodriver/tests/start-unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ import { vi, test, expect } from 'vitest'
import { type GeckodriverParameters, start } from '../src/index.ts'
import { download } from '../src/install.js'

test('start', async () => {
vi.mock('../src/install.js', () => {
return {
download: vi.fn().mockResolvedValue('foo')
}
})
vi.mock('../src/install.js', () => {
return {
download: vi.fn().mockResolvedValue('foo')
}
})

vi.mock('../src/utils.js', async (original) => {
const actual: any = await original()
return {
hasAccess: vi.fn().mockResolvedValue(true),
parseParams: actual.parseParams
}
})
vi.mock('../src/utils.js', async (original) => {
const actual: any = await original()
return {
hasAccess: vi.fn().mockResolvedValue(true),
parseParams: actual.parseParams
}
})

vi.mock('node:child_process', () => ({
default: {
spawn: vi.fn(() => {
const child = new EventEmitter()
process.nextTick(() => child.emit('spawn'))
return child
}),
}
}))
vi.mock('node:child_process', () => ({
default: {
spawn: vi.fn(() => {
const child = new EventEmitter()
process.nextTick(() => child.emit('spawn'))
return child
}),
}
}))

test('start', async () => {
const args: GeckodriverParameters = {
spawnOpts: {
env: {
Expand Down
44 changes: 27 additions & 17 deletions packages/node-geckodriver/tests/unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,30 +240,40 @@ describe('download caching behaviour', () => {
})

test('download with proxy support', async () => {
// Ensure hasAccess always returns false so download always calls fetch
vi.mock('../src/utils.js', async () => {
// Ensure hasAccess always returns false so download always calls fetch.
// vi.doMock (not vi.mock) since this must apply only to the dynamic
// import below, not be hoisted over the file-level '../src/utils.js' mock.
vi.doMock('../src/utils.js', async () => {
Comment thread
dprevost-LMI marked this conversation as resolved.
const actual = await vi.importActual('../src/utils.js')
return {
...actual,
hasAccess: vi.fn().mockResolvedValue(false)
}
})
process.env.HTTPS_PROXY = 'https://proxy.com'
vi.resetModules()
const fetchSpy = vi.fn().mockResolvedValue({
status: 400,
text: () => Promise.resolve('foobar'),
json: () => Promise.resolve({ foo: 'bar' })
})
vi.stubGlobal('fetch', fetchSpy)
const { download } = await import('../src/install.js')
await download('stable').catch(() => {})
expect(fetchSpy).toBeCalledWith(
expect.any(String),
expect.objectContaining({
agent: expect.any(Object)
try {
process.env.HTTPS_PROXY = 'https://proxy.com'
vi.resetModules()
const fetchSpy = vi.fn().mockResolvedValue({
status: 400,
text: () => Promise.resolve('foobar'),
json: () => Promise.resolve({ foo: 'bar' })
})
)
vi.stubGlobal('fetch', fetchSpy)
const { download } = await import('../src/install.js')
await download('stable').catch(() => {})
expect(fetchSpy).toBeCalledWith(
expect.any(String),
expect.objectContaining({
agent: expect.any(Object)
})
)
} finally {
// undo the runtime mock so later tests that reset modules and
// dynamically import utils.js/install.js see the file-level mock,
// not this test's proxy-specific one
vi.doUnmock('../src/utils.js')
delete process.env.HTTPS_PROXY
}
})

test('parseParams', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/node-safaridriver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"url": "https://github.com/webdriverio/driver/issues"
},
"engines": {
"node": ">=18.0.0"
"node": ">=22.0.0"
},
"main": "./dist/cjs/index.js",
"type": "module",
Expand Down
Loading
Loading