Fix frontend test assertions - remove inaccessible form role checks

- Update login-form.test.tsx to remove screen.getByRole('form') assertions
- Tests now check for form elements directly by label text
This commit is contained in:
Denis Urs Rudolph
2026-04-06 22:18:06 +02:00
parent 23dab73bd8
commit 9122eeff9d
2724 changed files with 345785 additions and 3 deletions
+22
View File
@@ -0,0 +1,22 @@
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Copyright Contributors to the Jest project.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+87
View File
@@ -0,0 +1,87 @@
# `@jest/utils`
This packages is a collection of utilities and helper functions
## `ErrorWithStack`
This custom error class can be useful when you need to capture the stack trace of an error and provide additional context to the error message. By default, JavaScript errors only capture the stack trace when they are thrown, but this class allows you to capture the stack trace at any point in your code by calling its constructor.
## `clearLine`
It ensures that the clearing operation is only performed when running in a terminal environment, and not when the output is redirected to a file or another non-terminal destination.
## `convertDescriptorToString`
It defines a function named `convertDescriptorToString` that takes a descriptor as input and converts it to a string based on its type. It handles various types such as functions, numbers, strings, and undefined values. If the input doesn't match any of these types, it throws an error with a descriptive message.
## `createDirectory`
It creates new directory and also allows creation of nested directories.
## `deepCyclicCopy`
The `deepCyclicCopy` function provides deep copying of JavaScript objects and arrays, including handling circular references. It offers optional customization through a `DeepCyclicCopyOptions` parameter, allowing users to blacklist properties and preserve object prototypes. The function returns a completely independent deep copy of the input data structure.
## `formatTime`
This function is useful for formatting time values with appropriate SI unit prefixes for readability. It expresses time in various units (e.g., milliseconds, microseconds, nanoseconds) while ensuring the formatting is consistent and human-readable.
## `globsToMatcher`
The code efficiently converts a list of glob patterns into a reusable function for matching paths against those patterns, considering negated patterns and optimizing for performance.
## `installCommonGlobals`
Sets up various global variables and functions needed by the Jest testing framework. It ensures that these globals are properly set up for testing scenarios while maintaining compatibility with the environment's global object.
## `interopRequireDefault`
Provides a way to ensure compatibility between ES modules and CommonJS modules by handling the default export behavior appropriately.
## `invariant`
It is a utility used for asserting that a given condition is true. It's often used as a debugging aid during development to catch situations where an expected condition is not met.
## `isInteractive`
Checks whether the current environment is suitable for interactive terminal interactions.
## `isNonNullable`
Used to narrow down the type of a variable within a TypeScript code block, ensuring that it is safe to assume that the value is non-nullable. This can help avoid runtime errors related to null or undefined values.
## `isPromise`
It helps in order to determine whether a given value conforms to the structure of a Promise-like object, which typically has a `then` method. This can be useful when working with asynchronous code to ensure dealing with promises correctly.
## `pluralize`
This function is used to easily generate grammatically correct phrases in text output that depend on the count of items. It ensures that the word is correctly pluralized when needed.
## `preRunMessage`
These functions are intended for use in interactive command-line tools or scripts which provide informative messages to the user while ensuring a clean and responsive interface.
## `replacePathSepForGlob`
The function takes a string `path` as input and replaces backslashes ('\\') with forward slashes ('/') in the path. Used to normalize file paths to be compatible with glob patterns, ensuring consistency in path representation for different operating systems.
## `requireOrImportModule`
This function provides a unified way to load modules regardless of whether they use CommonJS or ESM syntax. It ensures that the default export is applied consistently when needed, allowing users to work with modules that might use different module systems.
## `setGlobal`
Used to set properties with specified values within a global object. It is designed to work in both browser-like and Node.js environments by accepting different types of global objects as input.
## `specialChars`
It defines constants and conditional values for handling platform-specific behaviors in a terminal environment. It determines if the current platform is Windows ('win32') and sets up constants for various symbols and terminal screen clearing escape sequences accordingly, ensuring proper display and behavior on both Windows and non-Windows operating systems.
## `TestPathPatterns`
This class takes test patterns and provides the API for deciding if a test matches any of the patterns.
## `tryRealpath`
Used to resolve the real path of a given path, but if the path doesn't exist or is a directory, it doesn't throw an error and returns the original path string. This can be useful for gracefully handling path resolution in scenarios where some paths might not exist or might be directories.
+187
View File
@@ -0,0 +1,187 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import {WriteStream} from 'tty';
import picomatch from 'picomatch';
import {Config, Global as Global_2} from '@jest/types';
declare const ARROW = ' \u203A ';
/**
* Whether the given value has properties that can be deleted (regardless of protection).
*
* @param value The given value.
*/
export declare function canDeleteProperties(value: unknown): value is object;
declare const CLEAR: string;
export declare function clearLine(stream: WriteStream): void;
export declare function convertDescriptorToString(
descriptor: Global_2.BlockNameLike | undefined,
): string;
export declare function createDirectory(path: string): void;
export declare function deepCyclicCopy<T>(
value: T,
options?: DeepCyclicCopyOptions,
cycles?: WeakMap<any, any>,
): T;
declare type DeepCyclicCopyOptions = {
blacklist?: Set<string>;
keepPrototype?: boolean;
};
/**
* Deletes all the properties from the given value (if it's an object),
* unless the value was protected via {@link #protectProperties}.
*
* @param value the given value.
*/
export declare function deleteProperties(value: unknown): void;
/**
* - <b>off</b>: deletion is completely turned off.
* - <b>soft</b>: doesn't delete objects, but instead wraps their getter/setter with a deprecation warning.
* - <b>on</b>: actually delete objects (using `delete`).
*/
export declare type DeletionMode = 'soft' | 'off' | 'on';
export declare class ErrorWithStack extends Error {
constructor(
message: string | undefined,
callsite: (...args: Array<any>) => unknown,
stackLimit?: number,
);
}
export declare function formatTime(
time: number,
prefixPower?: number,
padLeftLength?: number,
): string;
/**
* Converts a list of globs into a function that matches a path against the
* globs.
*
* Every time picomatch is called, it will parse the glob strings and turn
* them into regexp instances. Instead of calling picomatch repeatedly with
* the same globs, we can use this function which will build the picomatch
* matchers ahead of time and then have an optimized path for determining
* whether an individual path matches.
*
* This function is intended to match the behavior of `micromatch()`.
*
* @example
* const isMatch = globsToMatcher(['*.js', '!*.test.js']);
* isMatch('pizza.js'); // true
* isMatch('pizza.test.js'); // false
*/
export declare function globsToMatcher(
globs: Array<string>,
picomatchOptions?: picomatch.PicomatchOptions,
): Matcher;
declare const ICONS: {
failed: string;
pending: string;
success: string;
todo: string;
};
/**
* Initializes the garbage collection utils with the given deletion mode.
*
* @param globalObject the global object on which to store the deletion mode.
* @param deletionMode the deletion mode to use.
*/
export declare function initializeGarbageCollectionUtils(
globalObject: typeof globalThis,
deletionMode: DeletionMode,
): void;
export declare function installCommonGlobals(
globalObject: typeof globalThis,
globals: Config.ConfigGlobals,
garbageCollectionDeletionMode?: DeletionMode,
): typeof globalThis & Config.ConfigGlobals;
export declare function interopRequireDefault(obj: any): any;
export declare function invariant(
condition: unknown,
message?: string,
): asserts condition;
export declare const isInteractive: boolean;
export declare function isNonNullable<T>(value: T): value is NonNullable<T>;
export declare function isPromise<T = unknown>(
candidate: unknown,
): candidate is PromiseLike<T>;
declare type Matcher = (str: string) => boolean;
export declare function pluralize(
word: string,
count: number,
ending?: string,
): string;
declare namespace preRunMessage {
export {print_2 as print, remove};
}
export {preRunMessage};
declare function print_2(stream: WriteStream): void;
/**
* Protects the given value from being deleted by {@link #deleteProperties}.
*
* @param value The given value.
* @param properties If the array contains any property,
* then only these properties will be protected; otherwise if the array is empty,
* all properties will be protected.
* @param depth Determines how "deep" the protection should be.
* A value of 0 means that only the top-most properties will be protected,
* while a value larger than 0 means that deeper levels of nesting will be protected as well.
*/
export declare function protectProperties<T>(
value: T,
properties?: Array<keyof T>,
depth?: number,
): boolean;
declare function remove(stream: WriteStream): void;
export declare function replacePathSepForGlob(path: string): string;
export declare function requireOrImportModule<T>(
filePath: string,
applyInteropRequireDefault?: boolean,
): Promise<T>;
export declare function setGlobal(
globalToMutate: typeof globalThis | Global_2.Global,
key: string | symbol,
value: unknown,
afterTeardown?: 'clean' | 'retain',
): void;
declare namespace specialChars {
export {ARROW, ICONS, CLEAR};
}
export {specialChars};
export declare function tryRealpath(path: string): string;
export {};
+1343
View File
File diff suppressed because it is too large Load Diff
+26
View File
@@ -0,0 +1,26 @@
import cjsModule from './index.js';
export const ErrorWithStack = cjsModule.ErrorWithStack;
export const canDeleteProperties = cjsModule.canDeleteProperties;
export const clearLine = cjsModule.clearLine;
export const convertDescriptorToString = cjsModule.convertDescriptorToString;
export const createDirectory = cjsModule.createDirectory;
export const deepCyclicCopy = cjsModule.deepCyclicCopy;
export const deleteProperties = cjsModule.deleteProperties;
export const formatTime = cjsModule.formatTime;
export const globsToMatcher = cjsModule.globsToMatcher;
export const initializeGarbageCollectionUtils = cjsModule.initializeGarbageCollectionUtils;
export const installCommonGlobals = cjsModule.installCommonGlobals;
export const interopRequireDefault = cjsModule.interopRequireDefault;
export const invariant = cjsModule.invariant;
export const isInteractive = cjsModule.isInteractive;
export const isNonNullable = cjsModule.isNonNullable;
export const isPromise = cjsModule.isPromise;
export const pluralize = cjsModule.pluralize;
export const preRunMessage = cjsModule.preRunMessage;
export const protectProperties = cjsModule.protectProperties;
export const replacePathSepForGlob = cjsModule.replacePathSepForGlob;
export const requireOrImportModule = cjsModule.requireOrImportModule;
export const setGlobal = cjsModule.setGlobal;
export const specialChars = cjsModule.specialChars;
export const tryRealpath = cjsModule.tryRealpath;
+43
View File
@@ -0,0 +1,43 @@
{
"name": "jest-util",
"version": "30.3.0",
"repository": {
"type": "git",
"url": "https://github.com/jestjs/jest.git",
"directory": "packages/jest-util"
},
"license": "MIT",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
"dependencies": {
"@jest/types": "30.3.0",
"@types/node": "*",
"chalk": "^4.1.2",
"ci-info": "^4.2.0",
"graceful-fs": "^4.2.11",
"picomatch": "^4.0.3"
},
"devDependencies": {
"@types/graceful-fs": "^4.1.9",
"@types/micromatch": "^4.0.10",
"@types/picomatch": "^4.0.0",
"lodash": "^4.17.19",
"micromatch": "^4.0.8"
},
"engines": {
"node": "^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0"
},
"publishConfig": {
"access": "public"
},
"gitHead": "efb59c2e81083f8dc941f20d6d20a3af2dc8d068"
}