Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps-dev): bump @octokit/rest from 20.1.1 to 21.0.0 #15

Merged
merged 2 commits into from
Jul 3, 2024
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
38 changes: 22 additions & 16 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@
* Specifically, the inputs listed in `action.yml` should be set as environment
* variables following the pattern `INPUT_<INPUT_NAME>`.
*/

import * as core from '@actions/core'
import * as github from '@actions/github'
import * as main from '../src/main'
import { Octokit } from '@octokit/rest'
import { mockInputs } from './mock.helper'
import * as azdo from '../src/azdo'
import { WorkItemsBatchResponse } from '../src/azdoTypes'
import fs from 'fs'
import path from 'path'
import * as github from '@actions/github'

jest.mock('@actions/github', () => ({
getOctokit: jest.fn()
}))

// Mock the action's main function
const runMock = jest.spyOn(main, 'run')
Expand All @@ -24,7 +26,6 @@ let errorMock: jest.SpiedFunction<typeof core.error>
let getInputMock: jest.SpiedFunction<typeof core.getInput>
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>
let setOutputMock: jest.SpiedFunction<typeof core.setOutput>
let githubApi: Octokit
let getReleaseMock: jest.SpyInstance
let updateReleaseMock: jest.SpyInstance
let getOctokitMock: jest.SpyInstance
Expand All @@ -33,24 +34,29 @@ let getWorkItemsBatchMock: jest.SpiedFunction<typeof azdo.getWorkItemsBatch>
describe('action', () => {
beforeEach(() => {
jest.clearAllMocks()
githubApi = new Octokit()
// githubApi = new GitHub()

errorMock = jest.spyOn(core, 'error').mockImplementation()
getInputMock = jest.spyOn(core, 'getInput').mockImplementation()
setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation()
setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation()
getReleaseMock = jest.fn()
updateReleaseMock = jest.fn()

getReleaseMock = jest
.spyOn(githubApi.rest.repos, 'getRelease')
.mockImplementation()
updateReleaseMock = jest
.spyOn(githubApi.rest.repos, 'updateRelease')
.mockImplementation()
getOctokitMock = jest
.spyOn(github, 'getOctokit')
.mockImplementation()
/* eslint-disable @typescript-eslint/no-explicit-any */
.mockReturnValue(githubApi as any)
const mockOctokitInstance = {
rest: {
repos: {
getRelease: getReleaseMock,
updateRelease: updateReleaseMock
}
}
// Add other mocked methods as needed
}

getOctokitMock = github.getOctokit as jest.MockedFunction<
typeof github.getOctokit
>
getOctokitMock.mockReturnValue(mockOctokitInstance)

getWorkItemsBatchMock = jest
.spyOn(azdo, 'getWorkItemsBatch')
Expand Down
9 changes: 9 additions & 0 deletions __tests__/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"emitDeclarationOnly": false,
"noEmit": true,
"allowImportingTsExtensions": true
},
"include": ["src/**/*"]
}
133 changes: 113 additions & 20 deletions package-lock.json

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

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
"lint": "npx eslint . -c ./.github/linters/.eslintrc.yml",
"package": "npx ncc build src/index.ts -o dist --source-map --license licenses.txt",
"package:watch": "npm run package -- --watch",
"test": "npx jest",
"test": "NODE_OPTIONS=--experimental-vm-modules npx jest",
"all": "npm run format:write && npm run lint && npm run test && npm run coverage && npm run package"
},
"license": "MIT",
"jest": {
"testEnvironmentOptions": {
"NODE_OPTIONS": "--experimental-vm-modules"
},
"preset": "ts-jest",
"verbose": true,
"clearMocks": true,
Expand Down Expand Up @@ -92,7 +95,7 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@octokit/rest": "^20.1.1",
"@octokit/rest": "^21.0.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.3",
"@typescript-eslint/eslint-plugin": "^7.13.1",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"target": "ES2022",
"module": "NodeNext",
"module": "node16",
"rootDir": "./src",
"moduleResolution": "NodeNext",
"moduleResolution": "node16",
"baseUrl": "./",
"sourceMap": true,
"outDir": "./dist",
Expand Down
Loading