Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

chore: coordinate superset-ui unittest with main repository #1463

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

zhaoyongjie
Copy link
Contributor

@zhaoyongjie zhaoyongjie commented Nov 10, 2021

🏠 Internal
coordinate superset-ui unittest with main repository

  1. Jest use source code for module import
  2. remove dependence: @airbnb/config-jest
  3. remove @airbnb/config-jest related "setup" before unit test
  4. refactor some unittest
  5. clean up

@zhaoyongjie zhaoyongjie requested a review from a team as a code owner November 10, 2021 07:45
@vercel
Copy link

vercel bot commented Nov 10, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/HP3YmmXBKokKqvxjV9yq8HN4DQiM
✅ Preview: https://superset-ui-git-fork-zhaoyongjie-fixut-superset.vercel.app

@codecov
Copy link

codecov bot commented Nov 10, 2021

Codecov Report

Merging #1463 (cc5c68f) into master (ba2703f) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1463      +/-   ##
==========================================
+ Coverage   30.91%   30.94%   +0.02%     
==========================================
  Files         503      502       -1     
  Lines       10215    10213       -2     
  Branches     1761     1761              
==========================================
+ Hits         3158     3160       +2     
+ Misses       6805     6801       -4     
  Partials      252      252              
Impacted Files Coverage Δ
test/setup.ts
packages/superset-ui-core/src/style/index.tsx 100.00% <0.00%> (+50.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ba2703f...cc5c68f. Read the comment docs.

Copy link
Contributor

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd prefer to get @kgabryje @geido or @michael-s-molina to also take a look, as this is unfamiliar territory to me.

const spy = jest.spyOn(logging, 'warn');

beforeAll(() => {
spy.mockImplementation((info: any) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why do we need to mock logging methods? And why do they throw errors?

Copy link
Contributor Author

@zhaoyongjie zhaoyongjie Nov 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have removed @airbnb/config-jest/setup/console.js from jest.config.js. this script makes console.warn return a mock function.(This logic is simple though. But it stuck me for a long time.)

So I'm thinking of using the normal mock function in the unit test is better than before.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, so we just bring back relevant changes from removed library 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some test cases that need to get warning message.


// to support: npx jest --silent
const spy = jest.spyOn(logging, 'trace');
spy.mockImplementation(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we include logging.trace's argument here? Like:
throw new Error('Trace: ' + traceMessage)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mock just for logging.trace(), Ensure that when call the logging.trace(), there is Trace: at the beginning of the return.

Copy link
Contributor

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but just like Ville I'm not 100% familiar with those configs. Let's have third pair of eyes take a look just to be sure

Copy link
Contributor

@ktmud ktmud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants