Merge pull request #150 from oke-py/jest
chore(package): bump jest from 27.2.5 to 29.3.1
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import * as child_process from 'child_process'
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import {mocked} from 'ts-jest/utils'
|
||||
import {Audit} from '../src/audit'
|
||||
|
||||
jest.mock('child_process')
|
||||
@@ -10,11 +9,11 @@ const audit = new Audit()
|
||||
|
||||
describe('run', () => {
|
||||
beforeEach(() => {
|
||||
mocked(child_process).spawnSync.mockClear()
|
||||
jest.mocked(child_process).spawnSync.mockClear()
|
||||
})
|
||||
|
||||
test('finds vulnerabilities with default values', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
const stdout = fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
)
|
||||
@@ -35,7 +34,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('finds vulnerabilities with production flag enabled', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
const stdout = fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
)
|
||||
@@ -56,7 +55,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('finds vulnerabilities with json flag enabled', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
const stdout = fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.json')
|
||||
)
|
||||
@@ -77,7 +76,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('does not find vulnerabilities', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
const stdout = fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/success.txt')
|
||||
)
|
||||
@@ -98,7 +97,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('throws an error if error is not null', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
return {
|
||||
pid: 100,
|
||||
output: '',
|
||||
@@ -116,7 +115,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('throws an error if status is null', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
return {
|
||||
pid: 100,
|
||||
output: '',
|
||||
@@ -134,7 +133,7 @@ describe('run', () => {
|
||||
})
|
||||
|
||||
test('throws an error if stderr is null', () => {
|
||||
mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
jest.mocked(child_process).spawnSync.mockImplementation((): any => {
|
||||
return {
|
||||
pid: 100,
|
||||
output: '',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
import {mocked} from 'ts-jest/utils'
|
||||
import {Audit} from '../src/audit'
|
||||
import {run} from '../src/main'
|
||||
import * as issue from '../src/issue'
|
||||
@@ -14,8 +13,8 @@ jest.mock('../src/pr')
|
||||
describe('run: pr', () => {
|
||||
beforeEach(() => {
|
||||
// initialize mock
|
||||
mocked(Audit).mockClear()
|
||||
mocked(pr).createComment.mockClear()
|
||||
jest.mocked(Audit).mockClear()
|
||||
jest.mocked(pr).createComment.mockClear()
|
||||
|
||||
process.env.INPUT_AUDIT_LEVEL = 'low'
|
||||
process.env.INPUT_PRODUCTION_FLAG = 'false'
|
||||
@@ -28,7 +27,7 @@ describe('run: pr', () => {
|
||||
})
|
||||
|
||||
test('does not call pr.createComment if vulnerabilities are not found', () => {
|
||||
mocked(Audit).mockImplementation((): any => {
|
||||
jest.mocked(Audit).mockImplementation((): any => {
|
||||
return {
|
||||
stdout: fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/success.txt')
|
||||
@@ -46,7 +45,7 @@ describe('run: pr', () => {
|
||||
}
|
||||
})
|
||||
|
||||
mocked(pr).createComment.mockResolvedValue({
|
||||
jest.mocked(pr).createComment.mockResolvedValue({
|
||||
config: {},
|
||||
headers: {},
|
||||
status: 201,
|
||||
@@ -61,7 +60,7 @@ describe('run: pr', () => {
|
||||
})
|
||||
|
||||
test('calls pr.createComment if vulnerabilities are found in PR', () => {
|
||||
mocked(Audit).mockImplementation((): any => {
|
||||
jest.mocked(Audit).mockImplementation((): any => {
|
||||
return {
|
||||
stdout: fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
@@ -79,7 +78,7 @@ describe('run: pr', () => {
|
||||
}
|
||||
})
|
||||
|
||||
mocked(pr).createComment.mockResolvedValue({
|
||||
jest.mocked(pr).createComment.mockResolvedValue({
|
||||
config: {},
|
||||
headers: {},
|
||||
status: 201,
|
||||
@@ -96,7 +95,7 @@ describe('run: pr', () => {
|
||||
test('does not call pr.createComment if create_pr_comments is set to false', () => {
|
||||
process.env.INPUT_CREATE_PR_COMMENTS = 'false'
|
||||
|
||||
mocked(Audit).mockImplementation((): any => {
|
||||
jest.mocked(Audit).mockImplementation((): any => {
|
||||
return {
|
||||
stdout: fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
@@ -122,8 +121,8 @@ describe('run: pr', () => {
|
||||
describe('run: issue', () => {
|
||||
beforeEach(() => {
|
||||
// initialize mock
|
||||
mocked(Audit).mockClear()
|
||||
mocked(issue).getExistingIssueNumber.mockClear()
|
||||
jest.mocked(Audit).mockClear()
|
||||
jest.mocked(issue).getExistingIssueNumber.mockClear()
|
||||
|
||||
process.env.INPUT_AUDIT_LEVEL = 'low'
|
||||
process.env.INPUT_PRODUCTION_FLAG = 'false'
|
||||
@@ -138,7 +137,7 @@ describe('run: issue', () => {
|
||||
test('does not call octokit.rest.issues.create if create_issues is set to false', () => {
|
||||
process.env.INPUT_CREATE_ISSUES = 'false'
|
||||
|
||||
mocked(Audit).mockImplementation((): any => {
|
||||
jest.mocked(Audit).mockImplementation((): any => {
|
||||
return {
|
||||
stdout: fs.readFileSync(
|
||||
path.join(__dirname, 'testdata/audit/error.txt')
|
||||
@@ -156,7 +155,7 @@ describe('run: issue', () => {
|
||||
}
|
||||
})
|
||||
|
||||
mocked(issue).getExistingIssueNumber.mockResolvedValue(null)
|
||||
jest.mocked(issue).getExistingIssueNumber.mockResolvedValue(null)
|
||||
|
||||
expect(run).not.toThrowError()
|
||||
expect(issue.getExistingIssueNumber).not.toHaveBeenCalled()
|
||||
|
||||
4047
package-lock.json
generated
4047
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -33,7 +33,7 @@
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/jest": "^29.2.4",
|
||||
"@types/node": "^18.0.0",
|
||||
"@typescript-eslint/parser": "^5.46.0",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
@@ -41,11 +41,11 @@
|
||||
"eslint-plugin-github": "^4.3.6",
|
||||
"eslint-plugin-jest": "^26.5.3",
|
||||
"graphql": "^16.5.0",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
"jest": "^29.3.1",
|
||||
"jest-circus": "^29.3.1",
|
||||
"js-yaml": "^4.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
"ts-jest": "^27.0.6",
|
||||
"ts-jest": "^29.0.3",
|
||||
"typescript": "^4.9.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user