Skip to content
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

Merged
merged 21 commits into from Nov 17, 2018
Merged

Conversation

hemal7735
Copy link
Member

@hemal7735 hemal7735 commented Nov 8, 2018

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-packages-exists.test.tx - TS mock issue - npm-exists module is not getting mocked, as actual call is going
  • recursive-parser.test.tx -- defineTest parameter issue , already mentioned in tests(migration): typescript #613
  • cleanup equivalent .js , __fixtures__ and __snapshots__ files. (these are not removed for reference)

@hemal7735
Copy link
Member Author

@ematipico can you help moving things forwards?

@hemal7735
Copy link
Member Author

@dhruvdutt can you help me with the blockers?

Copy link
Member

@evenstensberg evenstensberg left a 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

@ematipico
Copy link
Contributor

Could please some comment on your code describing the problem in a detailed way?

Copy link
Contributor

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Left some comments

packages/utils/__tests__/npm-packages-exists.test.tx Outdated Show resolved Hide resolved
packages/utils/__tests__/recursive-parser.test.tx Outdated Show resolved Hide resolved
@hemal7735 hemal7735 changed the title tests(utils): WIP move tests to TS tests(utils): move tests to TS Nov 12, 2018
@webpack-bot
Copy link

Thank you for your pull request! The most important CI builds succeeded, we’ll review the pull request soon.

@hemal7735
Copy link
Member Author

@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) => {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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/

Copy link
Member

@dhruvdutt dhruvdutt Nov 17, 2018

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.

Copy link
Member

@dhruvdutt dhruvdutt left a 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. 💯

packages/utils/__tests__/npm-packages-exists.test.ts Outdated Show resolved Hide resolved
packages/utils/__tests__/ast-utils.test.ts Outdated Show resolved Hide resolved
Copy link
Member

@evenstensberg evenstensberg left a 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

@hemal7735
Copy link
Member Author

Ts thing on param needs to be sorted out

@evenstensberg are you talking about parenthesis from previous conversation?

Copy link
Member

@dhruvdutt dhruvdutt left a 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.

@hemal7735
Copy link
Member Author

Add INode type for all node paths.

@dhruvdutt can you comment on the file where you think change is required?

@webpack-bot
Copy link

@hemal7735 Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@dhruvdutt Please review the new changes.

@ematipico
Copy link
Contributor

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

@dhruvdutt
Copy link
Member

Agreed. I'm working on removing tslint. We can merge this for now.

Copy link
Member

@evenstensberg evenstensberg left a comment

Choose a reason for hiding this comment

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

Lgtm

@dhruvdutt
Copy link
Member

Please fix conflicts.

@hemal7735
Copy link
Member Author

Please fix conflicts.

@dhruvdutt I don't see github showing me any conflict.

@ematipico ematipico merged commit 243ea58 into webpack:ts-test Nov 17, 2018
dhruvdutt pushed a commit to dhruvdutt/webpack-cli that referenced this pull request Dec 6, 2018
* 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
ematipico pushed a commit that referenced this pull request Mar 16, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants