Set up tests after eject of the standard CRA
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 35/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- javascript, react, webpack
- Domaine
- build-system, frontend, testing
Piste de recherche
Start with setupTest.js and the test importing App.js, then inspect the added rule in config/webpack.config.js and the failing import from @ui5/webcomponents/dist/json-imports/i18n.js. Run the test after the eject configuration is applied; done means the test loads without the module parse error and the reported asset and i18n warnings remain addressed.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Hello Team,
I'm facing the following problem:
Steps to reproduce:
npx create-react-app </app_name>npm i -S @ui5/webcomponents-react- Follow the instructions for the tests Set up Tests
npm i -D enzyme enzyme-adapter-react-16- setupTest.js looks like this:
import '@testing-library/jest-dom/extend-expect';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
Enzyme.configure({ adapter: new Adapter() });
- App.js looks like this:
import React from 'react';
import '@ui5/webcomponents/dist/json-imports/i18n';
import '@ui5/webcomponents/dist/json-imports/Themes';
import '@ui5/webcomponents-fiori/dist/json-imports/Themes';
import './App.css';
import { Button, ShellBar, ThemeProvider } from '@ui5/webcomponents-react';
function App() {
return (
<div>
<ThemeProvider withToastContainer>
<ShellBar />
<Button>Click Me!</Button>
</ThemeProvider>
</div>
);
}
export default App;
- The test looks like this
import React from 'react';
import App from './App';
import { shallow } from 'enzyme'
test('renders learn react link', () => {
let shallow1 = shallow(<App />);
});
So far so good the test starts with 100 warnings in the console about the i18n (by the way your app is also starting with them ui5-webcomponents-sample-react ) but the test is loaded and so on.
so you are a suggesting to eject from the standard CRA and to continue on our own and to add in the config/webpack.config.js the following in order to solve the warnings:
{
test: [/cldr\/.*\.json$/, /i18n\/.*\.json$/, /assets\/.*\.json$/],
loader: 'file-loader',
options: {
name: 'static/media/[name].[hash:8].[ext]',
},
type: 'javascript/auto',
}
so far so good the warnings are gone from the console and all the assets are now loaded fine.
But the test is not working any mode I am getting the following error:
node_modules/@ui5/webcomponents/dist/json-imports/i18n.js:1
({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import { registerI18nBundle } from "@ui5/webcomponents-base/dist/asset-registries/i18n.js";
Which was solved before with Set up Tests
So please advice what I'm are doing wrong or what I'm missing in the whole configuration.
Thanks & Regards,
Ivan
- Langage dominant
- TypeScript
- Étoiles
- 62
- Forks
- 23
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de UI5/sample-webcomponents-react
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 35/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 32/100
UI5/sample-webcomponents-react#102 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 35/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 20/100
UI5/sample-webcomponents-react#72 · 1 commentaire ·
Toutes les issues de UI5/sample-webcomponents-react
Issues similaires
-
Difficulté 1/5 Moins d'une heure Accessibilité débutants 72/100
supadata-ai/mcp#27 ·
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
capricorn86/happy-dom#2485 ·
Les mainteneurs répondent en général sous 2 jours
-
优化导入 OCR 模型选择文件的按钮样式Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
siyuan-note/siyuan#20430 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Les mainteneurs répondent en général sous 2 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
Albert-Weasker/niubigeo#194 ·
Les mainteneurs répondent en général sous 1 jour