Files
spartan-ng__spartan/libs/brain/eslint.config.cjs
Ashley Hunter 1b743f8019 test: migrate from jest to vitest with browser testing for brain/helm
Replace Jest with Vitest across the workspace. The brain and helm Angular suites
now run in a real browser (Playwright/Chromium via Vitest browser mode) so they
exercise real layout, focus, pointer events and computed styles that jsdom could
not. The cli, tools, mcp, registry and cli-smoke suites run on Vitest's node
environment.

- Add per-project vite configs and switch test targets to @nx/vitest:test
- Convert jest APIs to vi.* and jest module mocks to vi.mock with importOriginal
- Replace jest-axe with a browser-native axe-core helper and toHaveNoViolations
- Regenerate snapshots in vitest format (content unchanged, format-only)
- Remove all jest packages, configs, the preset and the @nx/jest target default
- Install Playwright Chromium in the CI unit job for the browser suites

Also fixes a brain avatar test that asserted inside a fire-and-forget setTimeout,
which passed vacuously under jsdom and only surfaced once a real browser loaded
the image.
2026-06-13 15:16:45 +01:00

85 lines
2.4 KiB
JavaScript

const nx = require('@nx/eslint-plugin');
const baseConfig = require('../../eslint.config.cjs');
module.exports = [
...baseConfig,
...nx.configs['flat/angular'],
...nx.configs['flat/angular-template'],
{
files: ['**/*.ts'],
rules: {
'@angular-eslint/directive-selector': [
'error',
{
type: 'attribute',
prefix: 'brn',
style: 'camelCase',
},
],
'@angular-eslint/component-selector': [
'error',
{
type: 'element',
prefix: 'brn',
style: 'kebab-case',
},
],
// we may want to enable these at some point
'@angular-eslint/template/click-events-have-key-events': 'off',
'@angular-eslint/template/interactive-supports-focus': 'off',
'@angular-eslint/template/label-has-associated-control': 'off',
'@angular-eslint/directive-class-suffix': 'off',
'@angular-eslint/component-class-suffix': 'off',
'@angular-eslint/no-input-rename': 'off',
'@angular-eslint/no-output-rename': 'off',
'@angular-eslint/no-output-native': 'off',
'@angular-eslint/prefer-output-readonly': 'error',
'@angular-eslint/prefer-on-push-component-change-detection': ['error'],
'@angular-eslint/prefer-signals': ['error'],
'@nx/workspace-avoid-component-styles': 'error',
},
},
{
files: ['**/__tests__/*.ts'],
rules: {
'@angular-eslint/prefer-signals': 'off',
'@angular-eslint/directive-selector': 'off',
'@angular-eslint/component-selector': 'off',
},
},
{
files: ['**/*.html'],
// Override or add rules here
rules: {
// we may want to enable these at some point
'@angular-eslint/template/click-events-have-key-events': 'off',
'@angular-eslint/template/interactive-supports-focus': 'off',
'@angular-eslint/template/label-has-associated-control': 'off',
},
},
{
files: ['**/*.json'],
rules: {
'@nx/dependency-checks': [
'error',
{
ignoredFiles: [
'{projectRoot}/eslint.config.{js,cjs,mjs}',
'{projectRoot}/vite.config.{ts,mts}',
'{projectRoot}/**/test-setup.ts',
'{projectRoot}/src/testing/**/*.ts',
'{projectRoot}/**/*.spec.ts',
'{projectRoot}/**/*.stories.ts',
],
// tailwindcss and tw-animate-css are required peer dependencies consumed through the
// CSS preset (@import in hlm-tailwind-preset.css), which the dependency check cannot detect.
ignoredDependencies: ['tailwindcss', 'tw-animate-css'],
},
],
},
languageOptions: {
parser: require('jsonc-eslint-parser'),
},
},
];