Skip to content
Open
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
14 changes: 14 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ jobs:

- name: Run tests
run: npm run test:unit

component-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout pulp-ui (${{ github.ref }})
uses: actions/checkout@v7.0.1
with:
persist-credentials: false

- name: npm Setup
uses: $/.github/actions/npm-setup

- name: Run tests
run: npm run test:component
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ cypress/videos/*
dist/
node_modules/
npm-debug.log*

*storybook.log
storybook-static
.cache/
1 change: 1 addition & 0 deletions .storybook/global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.scss';
27 changes: 27 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { StorybookConfig } from '@storybook/react-webpack5';
import { dirname } from 'path';
import { fileURLToPath } from 'url';

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string) {
return dirname(fileURLToPath(import.meta.resolve(`${value}/package.json`)));
}
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
addons: [getAbsolutePath('@storybook/addon-webpack5-compiler-swc')],
framework: getAbsolutePath('@storybook/react-webpack5'),
webpackFinal: async (config) => {
config.module = config.module ?? { rules: [] };
config.module.rules = config.module.rules ?? [];
config.module.rules.push({
test: /\.(scss|sass)$/,
exclude: /\.css$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
});
return config;
},
};
export default config;
15 changes: 15 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import '@patternfly/patternfly/patternfly.scss';
import type { Preview } from '@storybook/react-webpack5';

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import eslintConfigPrettier from 'eslint-config-prettier';
import pluginCypress from 'eslint-plugin-cypress';
import pluginLingui from 'eslint-plugin-lingui';
import pluginReact from 'eslint-plugin-react/configs/recommended.js';
import storybook from 'eslint-plugin-storybook';
import { defineConfig } from 'eslint/config';
import globals from 'globals';
import tsEslint from 'typescript-eslint';
Expand All @@ -15,6 +16,7 @@ export default defineConfig([
tsEslint.configs.recommended,
tsEslint.configs.stylistic,
pluginLingui.configs['flat/recommended'],
...storybook.configs['flat/recommended'],
eslintConfigPrettier,
{
files: ['**/*.{js,jsx,mjs,cjs,ts,tsx}'],
Expand Down
Loading
Loading