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