-
Notifications
You must be signed in to change notification settings - Fork 69
Closed
Labels
Status: TriageThis is being looked at and prioritizedThis is being looked at and prioritizedType: BugSomething isn't working as documentedSomething isn't working as documentedreleased
Description
What happened?
Version 5 of @actions/github, I was able to do this within my tests:
import { getOctokit } from '@actions/github'
import type { Endpoints } from '@octokit/types'
import sinon from 'sinon'
const octokit = getOctokit('token')
const stubLabelList = () => {
return sinon.stub(octokit.rest.issues, 'listLabelsForRepo').resolves({
data: [MOCK_LIST_LABELS],
status: 200
} as Endpoints["GET /repos/{owner}/{repo}/labels"]["response"])
}
}
const github = {
getOctokit: () => octokit
}
// pass github and stubLabelList to other test functions etc As of version 6, I've had to do something like:
import { getOctokit } from '@actions/github'
import type { Endpoints } from '@octokit/types'
import sinon from 'sinon'
const octokit = getOctokit('token')
const github = {
getOctokit: () => {
...octokit,
rest: {
issues: {
listLabelsForRepo: () => {
return {
data: [MOCK_LIST_LABELS],
status: 200
} as Endpoints["GET /repos/{owner}/{repo}/labels"]["response"])
}
}
}
}
}I noticed this was a change in way the endpoints are generated and is now done via a proxy as of #622, could this of introduced unwanted side effects or is this the intended behaviour?
Versions
@actions/github: v6
NodeJS: 18
Relevant log output
TypeError: Cannot destructure property ‘decorations’ of ‘endpointMethodsMap.get(...).get(...)’ as it is undefined.Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Status: TriageThis is being looked at and prioritizedThis is being looked at and prioritizedType: BugSomething isn't working as documentedSomething isn't working as documentedreleased
Type
Projects
Status
✅ Done