Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
test: use jest
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Jul 25, 2023
1 parent 2c83037 commit 3531e46
Show file tree
Hide file tree
Showing 8 changed files with 5,231 additions and 2,594 deletions.
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
};
7,786 changes: 5,215 additions & 2,571 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"types": "dist/mjs/index.d.ts",
"scripts": {
"start": "npx vite serve",
"test": "vitest run",
"test": "jest",
"ci": "npm run test && npm run build",
"build": "npm run build:cjs && npm run build:mjs",
"build:mjs": "tsc --project tsconfig.mjs.json && cp res/package.mjs.json dist/mjs/package.json",
Expand All @@ -32,7 +32,9 @@
},
"homepage": "https://github.com/ably-labs/react-hooks#readme",
"devDependencies": {
"@testing-library/react": "^13.3.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.5.3",
"@typescript-eslint/eslint-plugin": "^6.1.0",
"@typescript-eslint/parser": "^6.1.0",
"@vitejs/plugin-react": "^1.3.2",
Expand All @@ -41,12 +43,15 @@
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"jsdom": "^20.0.0",
"prettier": "^3.0.0",
"react": ">=18.1.0",
"react-dom": ">=18.1.0",
"ts-jest": "^29.1.1",
"typescript": ">=4.4.4",
"vitest": "^0.18.0"
"vite": "^4.4.7"
},
"dependencies": {
"ably": "^1.2.27",
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useChannel.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { it, beforeEach, describe, expect } from 'vitest';
import { provideSdkInstance } from '../AblyReactHooks';
import { useChannel } from './useChannel';
import { useState } from 'react';
Expand Down
1 change: 0 additions & 1 deletion src/hooks/usePresence.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { it, beforeEach, describe, expect } from 'vitest';
import { provideSdkInstance } from '../AblyReactHooks';
import { usePresence } from './usePresence';
import { render, screen, act } from '@testing-library/react';
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
"esModuleInterop": true,
"declaration": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"skipLibCheck": true,
"allowJs": true,
"jsx": "react-jsx",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"types": ["vitest/globals"]
"lib": ["DOM", "DOM.Iterable", "ESNext"]
}
}
6 changes: 1 addition & 5 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig } from 'vitest/config';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig({
Expand All @@ -9,8 +9,4 @@ export default defineConfig({
host: true,
},
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
},
});
11 changes: 0 additions & 11 deletions vitest.config.ts

This file was deleted.

0 comments on commit 3531e46

Please sign in to comment.