-
Notifications
You must be signed in to change notification settings - Fork 14k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(monorepo): change coverage of core to 100% #17698
Conversation
Codecov Report
@@ Coverage Diff @@
## master #17698 +/- ##
==========================================
- Coverage 68.13% 67.75% -0.39%
==========================================
Files 1653 1602 -51
Lines 66247 64098 -2149
Branches 7107 6772 -335
==========================================
- Hits 45138 43430 -1708
+ Misses 19220 18815 -405
+ Partials 1889 1853 -36
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
const newScale = new CategoricalColorScale( | ||
scheme?.colors ?? [], | ||
this.forcedItems, | ||
); | ||
|
||
return newScale; | ||
return new CategoricalColorScale(scheme?.colors ?? [], this.forcedItems); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reformat
import seedrandom from 'seedrandom'; | ||
|
||
let random = seedrandom('superset-ui'); | ||
import _seedrandom from 'seedrandom'; | ||
|
||
export function seed(seed: string) { | ||
random = seedrandom(seed); | ||
return random; | ||
return _seedrandom(seed); | ||
} | ||
|
||
export function seedRandom() { | ||
return random(); | ||
return _seedrandom('superset-ui')(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor refactor, to avoid duplicate names(seedrandom).
jest.spyOn(logging, 'debug').mockImplementation(); | ||
jest.spyOn(logging, 'log').mockImplementation(); | ||
jest.spyOn(logging, 'info').mockImplementation(); | ||
expect(() => { | ||
logging.debug(); | ||
logging.log(); | ||
logging.info(); | ||
}).not.toThrow(); | ||
expect(() => { | ||
logging.warn('warn'); | ||
}).toThrow('warn'); | ||
expect(() => { | ||
logging.error('error'); | ||
}).toThrow('error'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mock console output, to make clear test output.
before
(superset) yongjie.zhao@:superset-frontend$ rm -rf coverage && npx jest --clearCache && NODE_ENV=test npx jest packages/superset-ui-core/test/utils/logging.test.ts
Cleared /private/var/folders/10/0l8mvpf52jx6t3p68mndwn7m0000gn/T/jest_dx
PASS packages/superset-ui-core/test/utils/logging.test.ts (9.898 s)
logging
✓ should pipe to `console` methods (4487 ms)
✓ should use noop functions when console unavailable (72 ms)
console.debug
undefined
at packages/superset-ui-core/test/utils/logging.test.ts:33:15
console.log
undefined
at packages/superset-ui-core/test/utils/logging.test.ts:34:15
console.info
undefined
at packages/superset-ui-core/test/utils/logging.test.ts:35:15
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 10.875 s
Ran all test suites matching /packages\/superset-ui-core\/test\/utils\/logging.test.ts/i.
After
(superset) yongjie.zhao@:superset-frontend$ rm -rf coverage && npx jest --clearCache && NODE_ENV=test npx jest packages/superset-ui-core/test/utils/logging.test.ts
Cleared /private/var/folders/10/0l8mvpf52jx6t3p68mndwn7m0000gn/T/jest_dx
PASS packages/superset-ui-core/test/utils/logging.test.ts (8.997 s)
logging
✓ should pipe to `console` methods (4409 ms)
✓ should use noop functions when console unavailable (84 ms)
Test Suites: 1 passed, 1 total
Tests: 2 passed, 2 total
Snapshots: 0 total
Time: 9.707 s
Ran all test suites matching /packages\/superset-ui-core\/test\/utils\/logging.test.ts/i.
@@ -33,13 +33,6 @@ import { | |||
} from './types'; | |||
import { DEFAULT_FETCH_RETRY_OPTIONS, DEFAULT_BASE_URL } from './constants'; | |||
|
|||
function redirectUnauthorized() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function move into class
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -16,7 +16,7 @@ coverage: | |||
target: auto | |||
threshold: 0% | |||
core-packages-ts: | |||
target: 95% | |||
target: 100% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
SUMMARY
make coverage of core package to 100%
link to shortcut: https://app.shortcut.com/preset/story/32255/yongjie-with-help-get-s-ui-packages-plugins-back-to-100-test-coverage
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After
TESTING INSTRUCTIONS
CI
ADDITIONAL INFORMATION