Skip to content

Commit

Permalink
Use @rocket.chat/jest-presets
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Aug 7, 2024
1 parent a2a14f4 commit cffe4c9
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 28 deletions.
2 changes: 2 additions & 0 deletions packages/jest-presets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"@swc/core": "~1.5.24",
"@swc/jest": "~0.2.36",
"@testing-library/jest-dom": "~6.4.5",
"@types/jest-axe": "~3.5.9",
"identity-obj-proxy": "~3.0.0",
"jest-axe": "~9.0.0",
"jest-environment-jsdom": "~29.7.0",
"uuid": "~9.0.1"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/jest-presets/src/client/jest-setup.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { TextEncoder, TextDecoder } from 'node:util';

import { toHaveNoViolations } from 'jest-axe';
import * as uuid from 'uuid';

import '@testing-library/jest-dom';

expect.extend(toHaveNoViolations);

const urlByBlob = new WeakMap<Blob, string>();
const blobByUrl = new Map<string, Blob>();

Expand Down
3 changes: 0 additions & 3 deletions packages/ui-video-conf/.jest/setup.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/ui-video-conf/jest.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions packages/ui-video-conf/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import client from '@rocket.chat/jest-presets/client';
import type { Config } from 'jest';

export default {
preset: client.preset,
setupFilesAfterEnv: [...client.setupFilesAfterEnv],
testMatch: ['<rootDir>/src/**/*.spec.{ts,tsx}'],
} satisfies Config;
9 changes: 5 additions & 4 deletions packages/ui-video-conf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"@rocket.chat/fuselage": "^0.57.0",
"@rocket.chat/fuselage-hooks": "^0.33.1",
"@rocket.chat/icons": "^0.36.0",
"@rocket.chat/jest-presets": "workspace:~",
"@rocket.chat/styled": "~0.31.25",
"@rocket.chat/ui-avatar": "workspace:^",
"@rocket.chat/ui-contexts": "workspace:^",
Expand All @@ -23,13 +24,13 @@
"@storybook/testing-react": "~1.3.0",
"@types/babel__core": "~7.20.3",
"@types/jest": "~29.5.12",
"@types/jest-axe": "^3.5.9",
"@types/jest-axe": "~3.5.9",
"eslint": "~8.45.0",
"eslint-plugin-react": "~7.32.2",
"eslint-plugin-react-hooks": "~4.6.0",
"eslint-plugin-storybook": "~0.6.15",
"jest": "~29.7.0",
"jest-axe": "^9.0.0",
"jest-axe": "~9.0.0",
"react-docgen-typescript-plugin": "~1.0.5",
"ts-jest": "~29.1.1",
"typescript": "~5.3.3"
Expand All @@ -49,9 +50,9 @@
"eslint": "eslint --ext .js,.jsx,.ts,.tsx .",
"eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix",
"test": "jest",
"build": "tsc -p tsconfig.json",
"build": "tsc -p tsconfig.build.json",
"storybook": "start-storybook -p 6006",
"dev": "tsc -p tsconfig.json --watch --preserveWatchOutput"
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput"
},
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[VideoConfButton Rendering] renders Default without crashing 1`] = `
exports[`renders Default without crashing 1`] = `
<body>
<div>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[VideoConfController Rendering] renders Default without crashing 1`] = `
exports[`renders Default without crashing 1`] = `
<body>
<div>
<button
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[VideoConfMessage Rendering] renders CallEnded without crashing 1`] = `
exports[`renders CallEnded without crashing 1`] = `
<body>
<div>
<div
Expand Down Expand Up @@ -207,7 +207,7 @@ exports[`[VideoConfMessage Rendering] renders CallEnded without crashing 1`] = `
</body>
`;

exports[`[VideoConfMessage Rendering] renders CallEndedDM without crashing 1`] = `
exports[`renders CallEndedDM without crashing 1`] = `
<body>
<div>
<div
Expand Down Expand Up @@ -377,7 +377,7 @@ exports[`[VideoConfMessage Rendering] renders CallEndedDM without crashing 1`] =
</body>
`;

exports[`[VideoConfMessage Rendering] renders CallOngoing without crashing 1`] = `
exports[`renders CallOngoing without crashing 1`] = `
<body>
<div>
<div
Expand Down Expand Up @@ -594,7 +594,7 @@ exports[`[VideoConfMessage Rendering] renders CallOngoing without crashing 1`] =
</body>
`;

exports[`[VideoConfMessage Rendering] renders CallingDM without crashing 1`] = `
exports[`renders CallingDM without crashing 1`] = `
<body>
<div>
<div
Expand Down Expand Up @@ -764,7 +764,7 @@ exports[`[VideoConfMessage Rendering] renders CallingDM without crashing 1`] = `
</body>
`;

exports[`[VideoConfMessage Rendering] renders Loading without crashing 1`] = `
exports[`renders Loading without crashing 1`] = `
<body>
<div>
<div
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`[VideoConfPopup Rendering] renders StartCall without crashing 1`] = `
exports[`renders StartCall without crashing 1`] = `
<body>
<div>
<div
Expand Down
5 changes: 5 additions & 0 deletions packages/ui-video-conf/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["./src/**/*"],
"exclude": ["./src/**/*.stories.tsx", "./src/**/*.spec.ts", "./src/**/*.spec.tsx"]
}
4 changes: 2 additions & 2 deletions packages/ui-video-conf/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "../../tsconfig.base.client.json",
"compilerOptions": {
"rootDir": "./src",
"rootDirs": ["./src", "./"],
"outDir": "./dist"
},
"include": ["./src/**/*"]
"include": ["./src/**/*", "./jest.config.ts"],
}
11 changes: 7 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9106,10 +9106,12 @@ __metadata:
"@testing-library/jest-dom": ~6.4.5
"@types/identity-obj-proxy": ^3
"@types/jest": ~29.5.12
"@types/jest-axe": ~3.5.9
"@types/uuid": ^9
eslint: ~8.45.0
identity-obj-proxy: ~3.0.0
jest: ~29.7.0
jest-axe: ~9.0.0
jest-environment-jsdom: ~29.7.0
typescript: ~5.4.5
uuid: ~9.0.1
Expand Down Expand Up @@ -10504,6 +10506,7 @@ __metadata:
"@rocket.chat/fuselage": ^0.57.0
"@rocket.chat/fuselage-hooks": ^0.33.1
"@rocket.chat/icons": ^0.36.0
"@rocket.chat/jest-presets": "workspace:~"
"@rocket.chat/styled": ~0.31.25
"@rocket.chat/ui-avatar": "workspace:^"
"@rocket.chat/ui-contexts": "workspace:^"
Expand All @@ -10518,13 +10521,13 @@ __metadata:
"@storybook/testing-react": ~1.3.0
"@types/babel__core": ~7.20.3
"@types/jest": ~29.5.12
"@types/jest-axe": ^3.5.9
"@types/jest-axe": ~3.5.9
eslint: ~8.45.0
eslint-plugin-react: ~7.32.2
eslint-plugin-react-hooks: ~4.6.0
eslint-plugin-storybook: ~0.6.15
jest: ~29.7.0
jest-axe: ^9.0.0
jest-axe: ~9.0.0
react-docgen-typescript-plugin: ~1.0.5
ts-jest: ~29.1.1
typescript: ~5.3.3
Expand Down Expand Up @@ -13803,7 +13806,7 @@ __metadata:
languageName: node
linkType: hard

"@types/jest-axe@npm:^3.5.9":
"@types/jest-axe@npm:~3.5.9":
version: 3.5.9
resolution: "@types/jest-axe@npm:3.5.9"
dependencies:
Expand Down Expand Up @@ -27943,7 +27946,7 @@ __metadata:
languageName: node
linkType: hard

"jest-axe@npm:^9.0.0":
"jest-axe@npm:~9.0.0":
version: 9.0.0
resolution: "jest-axe@npm:9.0.0"
dependencies:
Expand Down

0 comments on commit cffe4c9

Please sign in to comment.