test: добавить площадку интеграционного тестирования

- добавлены consumer fixtures для React и Next.js
- добавлены typecheck, production build и браузерные smoke-тесты
- добавлена интеграционная проверка в CI
This commit is contained in:
2026-07-13 20:08:31 +03:00
parent 7992adc9d3
commit 632b450c8b
130 changed files with 26424 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
{
"name": "@svg-sprites-fixtures/react-webpack",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"sprites": "svg-sprites src/sprite/svg-sprite.config.ts",
"typecheck": "tsc --noEmit",
"build": "npm run sprites && webpack --mode production",
"dev": "npm run sprites && webpack serve --mode development"
},
"dependencies": {
"react": "19.2.5",
"react-dom": "19.2.5"
},
"devDependencies": {
"@gromlab/svg-sprites": "file:../../..",
"@types/react": "19.2.17",
"@types/react-dom": "19.2.3",
"css-loader": "7.1.4",
"html-webpack-plugin": "5.6.7",
"style-loader": "4.0.0",
"ts-loader": "9.6.2",
"typescript": "6.0.2",
"webpack": "5.108.4",
"webpack-cli": "7.2.1",
"webpack-dev-server": "5.2.2"
}
}

View File

@@ -0,0 +1,6 @@
declare module '*.module.css' {
const classes: Record<string, string>
export default classes
}
declare module '*.css'

View File

@@ -0,0 +1,22 @@
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { IconsIcon } from './sprite'
import './style.css'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<main>
<h1>React + Webpack</h1>
<IconsIcon
data-testid="icon"
data-app="react-webpack"
icon="check"
aria-label="Check icon"
width={64}
height={64}
style={{ '--icon-color-1': '#16a34a' }}
/>
</main>
</StrictMode>,
)

View File

@@ -0,0 +1,2 @@
# @generated by @gromlab/svg-sprites. Do not edit.
/.svg-sprite/

View File

@@ -0,0 +1 @@
export * from './.svg-sprite'

View File

@@ -0,0 +1,8 @@
import { defineSpriteConfig } from '@gromlab/svg-sprites'
export default defineSpriteConfig({
mode: 'react@webpack',
name: 'icons',
inputFiles: ['../../../../fixtures/icons/check.svg'],
generatedNotice: false,
})

View File

@@ -0,0 +1,10 @@
:root {
font-family: system-ui, sans-serif;
color: #172033;
background: #fff;
}
body {
margin: 0;
padding: 40px;
}

View File

@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "Bundler",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"jsx": "react-jsx",
"strict": true,
"skipLibCheck": true
},
"include": ["src"]
}

View File

@@ -0,0 +1,52 @@
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import HtmlWebpackPlugin from 'html-webpack-plugin'
const root = path.dirname(fileURLToPath(import.meta.url))
export default {
entry: './src/main.tsx',
output: {
path: path.join(root, 'dist'),
filename: 'assets/app.[contenthash].js',
assetModuleFilename: 'assets/[name].[contenthash][ext]',
clean: true,
},
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: 'ts-loader',
},
{
test: /\.module\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: {
namedExport: false,
},
},
},
],
},
{
test: /\.css$/,
exclude: /\.module\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
plugins: [
new HtmlWebpackPlugin({
templateContent: '<!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>React Webpack sprite fixture</title></head><body><div id="root"></div></body></html>',
}),
],
}