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
tests(utils): move tests to TS #688
Conversation
@ematipico can you help moving things forwards? |
@dhruvdutt can you help me with the blockers? |
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.
ping ping @webpack/cli-team
Could please some comment on your code describing the problem in a detailed way? |
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.
Left some comments
Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon. |
@evenstensberg @ematipico @dhruvdutt please review this as all pending tasks are completed now. |
@@ -105,41 +105,41 @@ const a = { plugs: [] } | |||
describe("createOrUpdatePluginByName", () => { | |||
it("should create a new plugin without arguments", () => { | |||
const ast = j("{ plugins: [] }"); | |||
ast.find(j.ArrayExpression).forEach(node => { | |||
utils.createOrUpdatePluginByName(j, node, "Plugin"); | |||
ast.find(j.ArrayExpression).forEach((node) => { |
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.
@ematipico I think we were agreeing on non-enclosed paran when single arg?
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.
Current tslint
configuration is strict in those areas. eslint
config is still relaxed.
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.
Can we make it as we agreed? Think Emanuelle has some comments there
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.
We will need to use "arrow-parens": [true, "ban-single-arg-parens"]" in tslint config
more info: https://palantir.github.io/tslint/rules/arrow-parens/
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.
forEach((node) => {
forEach((node: INode) => {
@hemal7735 Can you follow this for all occurrences of node
and path
. Check ast-utils.ts
files for reference.
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.
Sorry for the late response. 😅
Minor changes but looks good overall. 💯
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.
Ts thing on param needs to be sorted out
@evenstensberg are you talking about parenthesis from previous conversation? |
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.
Add INode
type for all node paths.
@dhruvdutt can you comment on the file where you think change is required? |
@hemal7735 Thanks for your update. I labeled the Pull Request so reviewers will review it again. @dhruvdutt Please review the new changes. |
Resolving the TS linter problem will cause a waterfall effect where other files will be affected by the change. We can make a separate PR to fix the linter and we keep focusing on migrating the tests |
Agreed. I'm working on removing tslint. We can merge this for now. |
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
Please fix conflicts. |
@dhruvdutt I don't see github showing me any conflict. |
* chore(test): add migrate test * chore(lint): revert change * chore(test): moved to typescript migrate tests * tests(ts): moved module concatenation plugin to ts * tests(migrate): moved to typescript * tests(webpack-scaffold): moved to typescript * tests(utils): copy fixtures to __tests_ * tests(utils): move package-manager.test.js to TS * tests(utils): move validate-identifier.test.js to TS * tests(utils): move resolve-packages.test.js to TS * tests(utils): is-local-path.test.js to TS * tests(utils): move npm-exists.test.js to TS * tests(utils): move ast-utils.test.js to TS * tests(utils): WIP-test-cases * tests(utils): move recursive-parser.test.js to TS * tests(utils): move npm-package-exists.test.js to TS * tests(utils): cleanup .js , __fixtures__ and __snapshots__ files * chore(utils): clean console recursive-parser.test.ts * chore(utils): make options param optional * chore: use INode in ast-utils.test.ts
* chore(test): add migrate test * chore(lint): revert change * chore(test): moved to typescript migrate tests * tests(ts): moved module concatenation plugin to ts * tests(migrate): moved to typescript * tests(webpack-scaffold): moved to typescript * tests(migrate): clean js text fixtures * tests(migrate): update babel-loader test * tests(migrate): update babel-loader snapshot * tests(utils): move tests to TS (#688) * chore(test): add migrate test * chore(lint): revert change * chore(test): moved to typescript migrate tests * tests(ts): moved module concatenation plugin to ts * tests(migrate): moved to typescript * tests(webpack-scaffold): moved to typescript * tests(utils): copy fixtures to __tests_ * tests(utils): move package-manager.test.js to TS * tests(utils): move validate-identifier.test.js to TS * tests(utils): move resolve-packages.test.js to TS * tests(utils): is-local-path.test.js to TS * tests(utils): move npm-exists.test.js to TS * tests(utils): move ast-utils.test.js to TS * tests(utils): WIP-test-cases * tests(utils): move recursive-parser.test.js to TS * tests(utils): move npm-package-exists.test.js to TS * tests(utils): cleanup .js , __fixtures__ and __snapshots__ files * chore(utils): clean console recursive-parser.test.ts * chore(utils): make options param optional * chore: use INode in ast-utils.test.ts * tests(migrate): adds interface ILazyTransformObject * chore(commitlint): remove deprecated lang rule * chore(typings): fix tslint error * tests(migration): refactor dirName in a variable * tests(migrate): refactor dirName in variable 2 * tests(migrate): import path.resolve & add rootPath variable * tests(utils): adds type in forEach * tests(migrate): refactor resolve.test * chore(tests): enable ts in tests * chore(tests): remove unwanted script
What kind of change does this PR introduce?
We are moving
utils
package test-cases to TS.Did you add tests for your changes? NA
If relevant, did you update the documentation? NA
Summary
This PR address the #613 - tests(migration): typescript
Does this PR introduce a breaking change? NA
Other information
There are some tests files for which help is needed, I have changed them to
.tx
to allow me to push to GitHub.Pending Tasks:
npm-exists
module is not getting mocked, as actual call is going.js
,__fixtures__
and__snapshots__
files. (these are not removed for reference)