Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update jest preset #9874

Merged
merged 1 commit into from
Dec 2, 2024
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
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"useLightClient": false,
"namedInputs": {
"sharedGlobals": [
"{workspaceRoot}/project/testing/**/*.ts",
"{workspaceRoot}/projects/testing/**/*.ts",
"{workspaceRoot}/nx.json",
"{workspaceRoot}/package-lock.json",
"{workspaceRoot}/tsconfig.*.json",
Expand Down
5 changes: 3 additions & 2 deletions projects/testing/setup-jest/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/// <reference types="jest" />
import 'jest-preset-angular/setup-jest';

import {tuiSwitchNgDevMode} from '@taiga-ui/testing/mocks';
import {setupZoneTestEnv} from 'jest-preset-angular/setup-env/zone';

tuiSwitchNgDevMode(false);

setupZoneTestEnv(); // drop it after migrate zone less mode

const {TextEncoder: TextEncoderMock, TextDecoder: TextDecoderMock} = require('node:util');

global.TextEncoder = TextEncoderMock;
Expand All @@ -17,7 +18,7 @@

// you can also pass the mock implementation
// to jest.fn as an argument
(global.window as any).IntersectionObserver = jest.fn(() => ({

Check warning on line 21 in projects/testing/setup-jest/index.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/testing/setup-jest/index.ts#L21

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
observe: jest.fn(),
unobserve: jest.fn(),
disconnect: jest.fn(),
Expand All @@ -29,8 +30,8 @@
resizeEvent.initEvent('resize', true, true);

global.window.resizeTo = (width) => {
(global.window as any).innerWidth = width || global.window.innerWidth;

Check warning on line 33 in projects/testing/setup-jest/index.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/testing/setup-jest/index.ts#L33

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
(global.window as any).innerHeight = width || global.window.innerHeight;

Check warning on line 34 in projects/testing/setup-jest/index.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/testing/setup-jest/index.ts#L34

Unexpected any. Specify a different type. (@typescript-eslint/no-explicit-any)
global.window.dispatchEvent(resizeEvent);
};

Expand Down Expand Up @@ -107,7 +108,7 @@

Object.defineProperty(global.window, 'getComputedStyle', {
value: () => ({
getPropertyValue: (_prop: string) => '',

Check notice on line 111 in projects/testing/setup-jest/index.ts

View check run for this annotation

codefactor.io / CodeFactor

projects/testing/setup-jest/index.ts#L111

'_prop' is defined but never used. (@typescript-eslint/no-unused-vars)
}),
});

Expand Down
Loading