Describe the bug
Currently, there are many console.errors in the unit test. To build a clean unit test, we want to investigate these console errors and clean up if possible. Some examples are:
PASS src/core/public/application/ui/app_container.test.tsx
● Console
console.error
[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry. Using default message as fallback.
at defaultFormatMessage (node_modules/react-intl/lib/index.js:1533:13)
at FormattedMessage.render (node_modules/react-intl/lib/index.js:1638:30)
at finishClassComponent (node_modules/react-dom/cjs/react-dom.development.js:18470:31)
at updateClassComponent (node_modules/react-dom/cjs/react-dom.development.js:18423:24)
at beginWork$1 (node_modules/react-dom/cjs/react-dom.development.js:20186:16)
at beginWork$$1 (node_modules/react-dom/cjs/react-dom.development.js:25756:14)
at performUnitOfWork (node_modules/react-dom/cjs/react-dom.development.js:24698:12)
at workLoopSync (node_modules/react-dom/cjs/react-dom.development.js:24671:22)
FAIL packages/osd-telemetry-tools/src/tools/manage_schema.test.ts (5.505 s)
● generateMapping › generates a mapping file
: Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error:
45 |
46 | describe('generateMapping', () => {
> 47 | it('generates a mapping file', async () => {
| ^
48 | const mockSchema = await parseJsonFile('mock_schema.json');
49 | const result = generateMapping([parsedWorkingCollector]);
50 | expect(result).toEqual(mockSchema);
at new Spec (node_modules/jest-jasmine2/build/jasmine/Spec.js:116:22)
at Suite.Object.<anonymous>.describe (packages/osd-telemetry-tools/src/tools/manage_schema.test.ts:47:3)
at Object.<anonymous> (packages/osd-telemetry-tools/src/tools/manage_schema.test.ts:46:1)
To Reproduce
Run:
yarn test:jest --runInBand --detectOpenHandles --reporters=default
If see an error like this:
$ node scripts/jest --runInBand --detectOpenHandles
Error: An error occurred while adding the reporter at path "/home/anan/work/OpenSearch-Dashboards/src/dev/jest/junit_reporter.js".In database main: Invalid argument
at renewReadTxn (/home/anan/work/OpenSearch-Dashboards/node_modules/lmdb-store/index.js:79:11)
at LMDBStore.get (/home/anan/work/OpenSearch-Dashboards/node_modules/lmdb-store/index.js:205:39)
at Cache.getMtime (/home/anan/work/OpenSearch-Dashboards/packages/osd-optimizer/src/node/cache.ts:112:24)
at compile (/home/anan/work/OpenSearch-Dashboards/packages/osd-optimizer/src/node/node_auto_tranpilation.ts:98:15)
at /home/anan/work/OpenSearch-Dashboards/packages/osd-optimizer/src/node/node_auto_tranpilation.ts:169:16
at Module._compile (/home/anan/work/OpenSearch-Dashboards/node_modules/pirates/lib/index.js:93:29)
at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Object.newLoader [as .js] (/home/anan/work/OpenSearch-Dashboards/node_modules/pirates/lib/index.js:104:7)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
then pass ab argument:
yarn test:jest --runInBand --detectOpenHandles --reporters=default
Expected behavior
explore each problem unit test and do the following step for each test suite
- create a sub issue for each test suite
- check the following questions:
-
what causes the console error or issues?
-
should this unit test log this error or warning message?
-
if answer to the above question is no, then can we fix it?
The final output is expected to be a cleaned unit test with un-necessary error/warnings been removed.
OpenSearch Version
OpenSearch 1.0.0
Dashboards Version
Dashboards 1.0.0
Sub issues
Describe the bug
Currently, there are many console.errors in the unit test. To build a clean unit test, we want to investigate these console errors and clean up if possible. Some examples are:
To Reproduce
Run:
yarn test:jest --runInBand --detectOpenHandles --reporters=defaultIf see an error like this:
then pass ab argument:
yarn test:jest --runInBand --detectOpenHandles --reporters=defaultExpected behavior
explore each problem unit test and do the following step for each test suite
what causes the console error or issues?
should this unit test log this error or warning message?
if answer to the above question is no, then can we fix it?
The final output is expected to be a cleaned unit test with un-necessary error/warnings been removed.
OpenSearch Version
OpenSearch 1.0.0
Dashboards Version
Dashboards 1.0.0
Sub issues
issue: #555
issue: #556
issue: #557