Skip to content

Commit

Permalink
chore(auth-providers): switch firebase-web to vitest (#11466)
Browse files Browse the repository at this point in the history
Switches from jest to vitest. We can remove some of the workaround which
happened to previously be required with jest.
  • Loading branch information
Josh-Walker-GM authored Sep 8, 2024
1 parent b04f00c commit 43b1f2f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 63 deletions.
9 changes: 0 additions & 9 deletions packages/auth-providers/firebase/web/jest.config.js

This file was deleted.

7 changes: 0 additions & 7 deletions packages/auth-providers/firebase/web/jest.setup.js

This file was deleted.

9 changes: 4 additions & 5 deletions packages/auth-providers/firebase/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build:types": "tsc --build --verbose",
"build:watch": "nodemon --watch src --ext \"js,jsx,ts,tsx,template\" --ignore dist --exec \"yarn build\"",
"prepublishOnly": "NODE_ENV=production yarn build",
"test": "jest src",
"test:watch": "yarn test --watch"
"test": "vitest run",
"test:watch": "vitest watch"
},
"dependencies": {
"@babel/runtime-corejs3": "7.25.0",
Expand All @@ -32,10 +32,9 @@
"@babel/core": "^7.22.20",
"@types/react": "^18.2.55",
"firebase": "10.13.0",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"react": "19.0.0-rc-8269d55d-20240802",
"typescript": "5.5.4"
"typescript": "5.5.4",
"vitest": "2.0.5"
},
"peerDependencies": {
"firebase": "10.13.0"
Expand Down
39 changes: 0 additions & 39 deletions packages/auth-providers/firebase/web/resolver.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { renderHook, act } from '@testing-library/react'
import type FirebaseAuthNamespace from 'firebase/auth'
import type { User, OAuthProvider, Auth } from 'firebase/auth'
import { OperationType } from 'firebase/auth'
import { vi, beforeAll, beforeEach, describe, it, expect } from 'vitest'

import type { CurrentUser } from '@redwoodjs/auth'

Expand Down Expand Up @@ -117,7 +118,7 @@ const firebaseMockClient: FirebaseClient = {
firebaseAuth: firebaseAuth as typeof FirebaseAuthNamespace,
}

const fetchMock = jest.fn()
const fetchMock = vi.fn()
fetchMock.mockImplementation(async (_url, options) => {
const body = options?.body ? JSON.parse(options.body) : {}

Expand Down
8 changes: 8 additions & 0 deletions packages/auth-providers/firebase/web/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig, configDefaults } from 'vitest/config'

export default defineConfig({
test: {
exclude: [...configDefaults.exclude, '**/fixtures'],
environment: 'jsdom',
},
})
3 changes: 1 addition & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7609,10 +7609,9 @@ __metadata:
"@types/react": "npm:^18.2.55"
core-js: "npm:3.38.0"
firebase: "npm:10.13.0"
jest: "npm:29.7.0"
jest-environment-jsdom: "npm:29.7.0"
react: "npm:19.0.0-rc-8269d55d-20240802"
typescript: "npm:5.5.4"
vitest: "npm:2.0.5"
peerDependencies:
firebase: 10.13.0
languageName: unknown
Expand Down

0 comments on commit 43b1f2f

Please sign in to comment.