Skip to content
Draft
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
14 changes: 7 additions & 7 deletions __tests__/generate-sbom.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {describe, expect, jest, it, beforeEach} from '@jest/globals'
import {describe, expect, vi, it, beforeEach} from 'vitest'
import {generateSBOM} from '../src/generate-sbom'
import fs from 'fs'

// Mock the Octokit import
jest.mock('octokit', () => ({
Octokit: jest.fn().mockImplementation(() => ({
request: jest.fn()
vi.mock('octokit', () => ({
Octokit: vi.fn().mockImplementation(() => ({
request: vi.fn()
}))
}))

const mockSBOM = fs.readFileSync('./__tests__/mock-sbom.json', 'utf-8')

// Mock fs.writeFile
const mockWriteFile = jest
const mockWriteFile = vi
.spyOn(fs, 'writeFile')
.mockImplementation((f, d, callback: any) => {
console.log('[mock] writing file')
Expand All @@ -21,7 +21,7 @@ const mockWriteFile = jest

describe('generateSBOM', () => {
beforeEach(() => {
jest.clearAllMocks()
vi.clearAllMocks()
})

it('should retrieve the SBOM for a repository', async () => {
Expand All @@ -31,7 +31,7 @@ describe('generateSBOM', () => {
const sha = 'fe43fdf'

// Create a mock Octokit instance
const mockRequest = (jest.fn() as any).mockResolvedValue({
const mockRequest = (vi.fn() as any).mockResolvedValue({
data: {
sbom: JSON.parse(mockSBOM)
}
Expand Down
6 changes: 3 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// ESLint v9+ flat config migration from .eslintrc.json
import js from '@eslint/js';
import github from 'eslint-plugin-github';
import jest from 'eslint-plugin-jest';
import vitest from 'eslint-plugin-vitest';
import tseslint from 'typescript-eslint';
import prettier from 'eslint-plugin-prettier';

export default [
// Global ignores (must be first)
{
ignores: ['dist/**', 'lib/**', 'node_modules/**', 'jest.config.js']
ignores: ['dist/**', 'lib/**', 'node_modules/**', 'vitest.config.ts']
},

// Base configurations
Expand All @@ -21,7 +21,7 @@ export default [
plugins: {
'@typescript-eslint': tseslint.plugin,
github,
jest,
vitest,
prettier,
},
languageOptions: {
Expand Down
16 changes: 0 additions & 16 deletions jest.config.js

This file was deleted.

Loading