Set up tests after eject of the standard CRA
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript, react, webpack
- Ambito
- build-system, frontend, testing
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- TypeScript
- Stelle
- 62
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di UI5/sample-webcomponents-react
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 32/100
UI5/sample-webcomponents-react#102 · 1 commento ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
UI5/sample-webcomponents-react#72 · 1 commento ·
Tutte le issue di UI5/sample-webcomponents-react
Issue simili
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
-
Crush Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/cln-application#167 · 1 commento · 1 reazione ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Quantco/pnpm-licenses#17 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100