Skip to content
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
7 changes: 7 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"comfy/no-duplicate-ingest-type": "error",
"comfy/no-relative-packages": "error",
"comfy/no-js-private-class-members": "error",
"comfy/no-vitest-mock-method-names": "error",
"comfy/no-render-in-watch-effect": "error",
"comfy/no-useless-path-segments": "error",
"no-array-constructor": "error",
Expand Down Expand Up @@ -290,6 +291,12 @@
]
}
},
{
"files": ["**/vite.config.*", "**/vitest.config.*", "vitest.*.mts"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚪ Nit — vitest.*.mts is the only pattern in this override without a **/ prefix, so unlike its **/vite.config.* and **/vitest.config.* siblings it matches root-level files only. A package- or app-level Vitest config fragment declaring mockReset: true would then fail the repo-wide no-vitest-mock-method-names error. Raised by 2 of 8 reviewers (kimi-k3-max adversarial, claude-opus-5-thinking-max edge-case).

"rules": {
"comfy/no-vitest-mock-method-names": "off"
}
},
{
"files": ["src/**/*.{js,mjs,cjs,ts,mts,cts,vue}"],
"excludeFiles": ["src/**/*.test.{ts,tsx}"],
Expand Down
4 changes: 0 additions & 4 deletions apps/billing-web/src/config/firebase.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ const testIdentity = createTestIdentity({
onUserChanged: () => () => undefined
}) as unknown as FirebaseIdentity

beforeEach(() => {
h.resolveFirebaseIdentity.mockReset()
})

async function freshFirebase() {
vi.resetModules()
return import('@/config/firebase')
Expand Down
8 changes: 0 additions & 8 deletions apps/billing-web/src/session/stripeChallengePort.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ vi.mock<unknown>(import('@stripe/stripe-js/pure'), () => ({
import { createDeferredStripeChallengePort } from '@/session/stripeChallengePort'

describe('createDeferredStripeChallengePort', () => {
beforeEach(() => {
h.loadStripe.mockReset()
})

it('reports the challenge unavailable when no key is present at call time', async () => {
const port = createDeferredStripeChallengePort(() => undefined)

Expand Down Expand Up @@ -106,10 +102,6 @@ describe('createDeferredStripeChallengePort', () => {
})

describe('leavesPage', () => {
beforeEach(() => {
h.loadStripe.mockReset()
})

it.for<{ name: string; retrieved: unknown; leaves: boolean }>([
{
name: 'a challenge Stripe runs in the page',
Expand Down
6 changes: 1 addition & 5 deletions apps/website/src/config/workshop-firebase.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UserCredential } from 'firebase/auth'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'

import { captureSignupRollbackFailure } from '@/scripts/posthog'
import {
Expand Down Expand Up @@ -163,10 +163,6 @@ describe('popup sign-in', () => {
describe('social sign-in provisioning boundary', () => {
const user = { uid: 'u1', email: 'a@b.co', getIdToken: async () => 'jwt' }

beforeEach(() => {
h.signInWithGoogle.mockReset()
})

it('rethrows a popup failure untouched, so the caller sees the Firebase code', async () => {
const popupFailure = { code: 'auth/popup-closed-by-user', message: 'x' }
h.signInWithGoogle.mockRejectedValue(popupFailure)
Expand Down
20 changes: 12 additions & 8 deletions apps/website/src/scripts/posthog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const hoisted = vi.hoisted(() => ({
mockIsFeatureEnabled: vi.fn(),
mockGetFeatureFlag: vi.fn(),
mockIdentify: vi.fn(),
mockReset: vi.fn(),
mockPosthogReset: vi.fn(),
mockGetProperty: vi.fn(),
mockReloadFeatureFlags: vi.fn(),
mockSetPersonPropertiesForFlags: vi.fn()
Expand Down Expand Up @@ -62,7 +62,7 @@ const postHogMock = {
isFeatureEnabled: hoisted.mockIsFeatureEnabled,
getFeatureFlag: hoisted.mockGetFeatureFlag,
identify: hoisted.mockIdentify,
reset: hoisted.mockReset,
reset: hoisted.mockPosthogReset,
get_property: hoisted.mockGetProperty,
reloadFeatureFlags: hoisted.mockReloadFeatureFlags,
setPersonPropertiesForFlags: hoisted.mockSetPersonPropertiesForFlags
Expand Down Expand Up @@ -200,14 +200,16 @@ describe('Workshop visibility', () => {
hoisted.mockSetPersonPropertiesForFlags.mockClear()
hoisted.mockGetProperty.mockReturnValue('signed-in-before')
identifyWorkshopUser({ uid: 'someone-else' })
expect(hoisted.mockReset).toHaveBeenCalled()
expect(hoisted.mockPosthogReset).toHaveBeenCalled()
expect(hoisted.mockSetPersonPropertiesForFlags).toHaveBeenCalledWith(
environment,
false
)
expect(
hoisted.mockSetPersonPropertiesForFlags.mock.invocationCallOrder[0]
).toBeGreaterThan(hoisted.mockReset.mock.invocationCallOrder.at(-1) ?? 0)
).toBeGreaterThan(
hoisted.mockPosthogReset.mock.invocationCallOrder.at(-1) ?? 0
)
})

it('requires an explicit enable and keeps the last answer through load failures', async () => {
Expand Down Expand Up @@ -288,7 +290,7 @@ describe('Workshop visibility', () => {
emitFeatureFlags()
identifyWorkshopUser(null)
expect(useWorkshopEnabled().value).toBe(false)
expect(hoisted.mockReset).toHaveBeenCalledTimes(2)
expect(hoisted.mockPosthogReset).toHaveBeenCalledTimes(2)
expect(hoisted.mockReloadFeatureFlags).toHaveBeenCalledTimes(3)
})

Expand Down Expand Up @@ -436,7 +438,9 @@ describe('Workshop visibility', () => {
emitFeatureFlags()
vi.spyOn(console, 'error').mockImplementation(() => undefined)
const call =
operation === 'identify' ? hoisted.mockIdentify : hoisted.mockReset
operation === 'identify'
? hoisted.mockIdentify
: hoisted.mockPosthogReset
call.mockImplementationOnce(() => {
throw new Error('Unavailable')
})
Expand All @@ -455,14 +459,14 @@ describe('Workshop visibility', () => {
const { initPostHog, identifyWorkshopUser } = await import('./posthog')
initPostHog()
identifyWorkshopUser(null)
expect(hoisted.mockReset).not.toHaveBeenCalled()
expect(hoisted.mockPosthogReset).not.toHaveBeenCalled()

vi.resetModules()
hoisted.mockGetProperty.mockReturnValue('previous-user')
const restored = await import('./posthog')
restored.initPostHog()
restored.identifyWorkshopUser(null)
expect(hoisted.mockReset).toHaveBeenCalledOnce()
expect(hoisted.mockPosthogReset).toHaveBeenCalledOnce()
})
})

Expand Down
1 change: 0 additions & 1 deletion apps/website/src/utils/ashby.ci.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ describe('reportAshbyOutcome', () => {
})

afterEach(() => {
writeSpy.mockRestore()
rmSync(summaryDir, { recursive: true, force: true })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low — writeSpy replaces process.stdout.write with a swallowing stub and the automatic restore only runs before the next test, so dropping writeSpy.mockRestore() leaves stdout silenced for the remaining teardown (including anything surfaced by this rmSync) and after the final test in the file. The identical removal is in cloudNodes.ci.test.ts and featureFlags.ci.test.ts. Raised by 1 of 8 reviewers (claude-opus-5-thinking-max adversarial).

if (originalSummary === undefined) delete process.env.GITHUB_STEP_SUMMARY
else process.env.GITHUB_STEP_SUMMARY = originalSummary
Expand Down
1 change: 0 additions & 1 deletion apps/website/src/utils/cloudNodes.ci.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe('reportCloudNodesOutcome', () => {
})

afterEach(() => {
writeSpy.mockRestore()
rmSync(summaryDir, { recursive: true, force: true })
if (originalSummary === undefined) delete process.env.GITHUB_STEP_SUMMARY
else process.env.GITHUB_STEP_SUMMARY = originalSummary
Expand Down
1 change: 0 additions & 1 deletion apps/website/src/utils/featureFlags.ci.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ describe('reportFeatureFlagsOutcome', () => {
})

afterEach(() => {
writeSpy.mockRestore()
rmSync(summaryDir, { recursive: true, force: true })
if (originalSummary === undefined) delete process.env.GITHUB_STEP_SUMMARY
else process.env.GITHUB_STEP_SUMMARY = originalSummary
Expand Down
10 changes: 1 addition & 9 deletions src/components/helpcenter/HelpCenterMenuContent.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import userEvent from '@testing-library/user-event'
import { render, screen, waitFor } from '@testing-library/vue'
import axios from 'axios'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { computed, defineComponent, h } from 'vue'
import { createI18n } from 'vue-i18n'

Expand Down Expand Up @@ -102,10 +102,6 @@ describe('HelpCenterMenuContent feedback item', () => {
openSpy = vi.spyOn(window, 'open').mockReturnValue(null)
})

afterEach(() => {
openSpy.mockRestore()
})

it('opens the Typeform survey tagged with help-center source on Cloud', async () => {
distribution.isCloud = true
const { user } = renderComponent()
Expand Down Expand Up @@ -156,10 +152,6 @@ describe('HelpCenterMenuContent system status item', () => {
openSpy = vi.spyOn(window, 'open').mockReturnValue(null)
})

afterEach(() => {
openSpy.mockRestore()
})

it('opens the status page on Cloud', async () => {
distribution.isCloud = true
const { user } = renderComponent()
Expand Down
4 changes: 1 addition & 3 deletions src/components/load3d/modelThumbnail.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ function mockInstance(overrides: Record<string, unknown> = {}) {

describe('generateModelThumbnail', () => {
beforeEach(() => {
createLoad3d.mockReset()
isAssetPreviewSupported.mockReset().mockReturnValue(false)
persistThumbnail.mockReset()
isAssetPreviewSupported.mockReturnValue(false)
})

it('renders offscreen, returns the data url, and disposes the instance', async () => {
Expand Down
7 changes: 1 addition & 6 deletions src/components/queue/QueueOverlayExpanded.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render, screen } from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import { defineComponent } from 'vue'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { describe, expect, it, vi } from 'vitest'

import type { JobListItem } from '@/composables/queue/useJobList'

Expand Down Expand Up @@ -83,11 +83,6 @@ const stubs = {
}

describe('QueueOverlayExpanded', () => {
beforeEach(() => {
showMenuMock.mockClear()
toggleMenuMock.mockClear()
})

it('renders JobAssetsList', () => {
const { container } = render(QueueOverlayExpanded, {
props: defaultProps,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { useCommandStore } from '@/stores/commandStore'

Expand Down Expand Up @@ -32,10 +32,6 @@ describe('useErrorActions', () => {
windowOpenSpy = vi.spyOn(window, 'open').mockImplementation(() => null)
})

afterEach(() => {
windowOpenSpy.mockRestore()
})

describe('openGitHubIssues', () => {
it('tracks the button click and opens the GitHub issues URL in a new tab', () => {
const { openGitHubIssues } = useErrorActions()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { until } from '@vueuse/core'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { nextTick, ref } from 'vue'

import { useSystemStatsStore } from '@/stores/systemStatsStore'
Expand Down Expand Up @@ -73,10 +73,6 @@ describe('useErrorReport', () => {
warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
})

afterEach(() => {
warnSpy.mockRestore()
})

it('returns early without enrichment when the card has no runtime errors', async () => {
const card = makeCard({
errors: [{ message: 'static', details: 'details' }]
Expand Down
1 change: 0 additions & 1 deletion src/composables/useFeatureFlags.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,6 @@ describe('useFeatureFlags', () => {

describe('session override precedence', () => {
afterEach(() => {
vi.mocked(getSessionOverride).mockReset()
vi.mocked(distributionTypes).isCloud = false
vi.mocked(distributionTypes).isNightly = false
remoteConfigState.value = 'unloaded'
Expand Down
3 changes: 1 addition & 2 deletions src/composables/useLoad3dViewer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,8 +772,7 @@ describe('useLoad3dViewer', () => {

describe('standalone thumbnail persistence', () => {
beforeEach(() => {
isAssetPreviewSupported.mockReset().mockReturnValue(false)
persistThumbnail.mockReset()
isAssetPreviewSupported.mockReturnValue(false)
vi.stubGlobal(
'fetch',
vi.fn().mockResolvedValue({ blob: () => Promise.resolve(new Blob()) })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import type { PreviewExposure } from '@/core/schemas/previewExposureSchema'
import { toNodeId } from '@/types/nodeId'
Expand Down Expand Up @@ -50,10 +50,6 @@ describe(resolvePreviewExposureChain, () => {
warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
})

afterEach(() => {
warnSpy.mockRestore()
})

it('returns undefined when the named exposure is not on the starting host', () => {
const ctx = makeContext(new Map(), [])
expect(
Expand Down
1 change: 0 additions & 1 deletion src/extensions/core/groupOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const BASE_GROUP_ITEMS: (string | null)[] = [
]

beforeEach(() => {
graphChange.mockClear()
vi.mocked(useSettingStore().get).mockReturnValue(10)
})

Expand Down
6 changes: 1 addition & 5 deletions src/lib/litegraph/src/LGraph.serialise.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { beforeEach, describe } from 'vitest'
import { describe } from 'vitest'

import {
LGraph,
Expand All @@ -18,10 +18,6 @@ vi.mock(import('@/platform/telemetry/reportError'), () => ({
reportError: mockReportError
}))

beforeEach(() => {
mockReportError.mockClear()
})

describe('LGraph Serialisation', () => {
test('can (de)serialise node / group titles', ({ expect, minimalGraph }) => {
const nodeTitle = 'Test Node'
Expand Down
1 change: 0 additions & 1 deletion src/lib/litegraph/src/graphIntents.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function track(detach: () => void): void {

afterEach(() => {
for (const detach of detachers.splice(0)) detach()
vi.mocked(reportError).mockClear()
})

describe('withGraphIntentSource', () => {
Expand Down
1 change: 0 additions & 1 deletion src/lib/litegraph/src/node/NodeInputSlot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ describe('NodeInputSlot', () => {
const originalCallbacks = LiteGraph.onDeprecationWarning

beforeEach(() => {
onWarning.mockClear()
LiteGraph.onDeprecationWarning = [onWarning]
LiteGraph.alwaysRepeatWarnings = true
})
Expand Down
1 change: 0 additions & 1 deletion src/lib/litegraph/src/node/NodeOutputSlot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('NodeOutputSlot deprecated links getter', () => {
const onWarning = vi.fn()

beforeEach(() => {
onWarning.mockClear()
LiteGraph.onDeprecationWarning = [onWarning]
LiteGraph.alwaysRepeatWarnings = true
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ describe('useUploadModelWizard', () => {
}

afterEach(() => {
vi.mocked(api.getServerFeature).mockReset()
for (const app of mountedApps.splice(0)) {
app.unmount()
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/cloud/oauth/OAuthConsentView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ const renderConsent = (overrides: Partial<OAuthConsentChallenge> = {}) =>

describe('OAuthConsentView', () => {
beforeEach(() => {
mockSubmitOAuthConsentDecision.mockReset().mockResolvedValue(undefined)
mockSubmitOAuthConsentDecision.mockResolvedValue(undefined)
})

it('loads the consent named in the URL on the session cookie alone, as an SSO callback lands', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function mountRedirect() {

describe('useOAuthPostLoginRedirect', () => {
beforeEach(() => {
createSessionOrThrow.mockReset().mockResolvedValue(undefined)
createSessionOrThrow.mockResolvedValue(undefined)
})

it('returns no-oauth when neither query nor sessionStorage holds a request id', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ describe('cloudOnboardingRoutes', () => {
*/
describe('legacy /login through the cloud-login guard', () => {
beforeEach(() => {
vi.mocked(useCurrentUser).mockClear()
clearOAuthRequestId()
})

Expand Down
Loading
Loading