-
Notifications
You must be signed in to change notification settings - Fork 7
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
[no-issue]: Convert web-config-server tests to jest #4194
Conversation
@@ -1,6 +1,6 @@ | |||
{ | |||
"clearMocks": true, | |||
"collectCoverageFrom": ["<rootDir>/src/**/*.js)"], |
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.
It seems that nobody was checking test coverage in JS packages for the last 14 months 😛
@@ -1,10 +1,3 @@ | |||
const getPlugins = api => { | |||
if (api.env(['development', 'test'])) { | |||
return ['istanbul']; |
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.
Build-related change, should be fine
...baseConfig, | ||
rootDir: '.', | ||
moduleNameMapper: { | ||
'^/aggregator(.*)$': '<rootDir>/src/aggregator$1', |
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.
I couldn't find a way to generalise these (without more elaborate folder scanning logic).
I also tried the following transformation. It throws an error because it is also applied to node_modules
packages:
'^/(.*)$': '<rootDir>/src/$1'
...config-server/src/__tests__/apiV1/dataBuilders/generic/table/tableOfDataValues/testTotals.js
Show resolved
Hide resolved
}, | ||
}; | ||
|
||
describe.skip('UserHasAccess', () => { |
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.
These tests actually fail and have been disabled for as long as I remember them... I'd suggest to just delete them
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.
I'm happy to delete them, what about you @edmofro
...onfig-server/src/__tests__/apiV1/dataBuilders/helpers/calculateOperationForAnalytics.test.js
Show resolved
Hide resolved
let app; | ||
|
||
beforeAll(async () => { | ||
app = new TestableApp(await createApp()); |
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.
I think that createApp()
needs not be async: app.js
It is not async in central-server
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.
Yep, doesn't need async, can you remove it @kael89? 🙏
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.
Happy to do so in another PR though! (Don't want touch production code in this one)
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.
Oh wow! This is so awesome!! Thanks @kael89 😄 The open-source community is becoming a real powerhouse!
Just a couple small comments, but pre-approving.
entityHierarchy: { findById: findEntityHierarchyById }, | ||
}; | ||
|
||
describe('ReportServerDataBuilder', () => { |
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.
These are new tests? Thanks so much for adding them! 🙌
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.
No just a rename and a bit of refactoring. Git thinks they are new though 🙂
...onfig-server/src/__tests__/apiV1/dataBuilders/helpers/calculateOperationForAnalytics.test.js
Show resolved
Hide resolved
}, | ||
}; | ||
|
||
describe.skip('UserHasAccess', () => { |
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.
I'm happy to delete them, what about you @edmofro
let app; | ||
|
||
beforeAll(async () => { | ||
app = new TestableApp(await createApp()); |
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.
Yep, doesn't need async, can you remove it @kael89? 🙏
53e4b74
to
dae0003
Compare
1 package left (
central-server
) and then mocha can go! 🎉Most of the job was done using a community codemod.
A few other tweaks too, see commits for an overview