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

Convert tests to TypeScript #369

Open
azu opened this Issue Dec 12, 2017 · 1 comment

Comments

Projects
None yet
1 participant
@azu
Member

azu commented Dec 12, 2017

We have conveted source codes of @textlint/kernel and textlint to TypeScript.
But, test codes is still JavaScript.

We want to convert to(or add) TypeScript test for it.

Main purposes

  • Add new TypeScript test code
    • It make the app stronge
  • Convert JavaScript test code to TypeScript code if it is possible
    • Some test is very hacky
    • It is not must

TypeScript test code help to find wrong type interface.

For example, current textlint-engine and textfix-engine is very strange implementation.
In other words, this implementaion is very hackly way.
Probably, It will be needed to refactor for passing typescript test code.

Adding or Converting test is that blame it 🔥

Priority

We want to get started with converting Public API testing.
Public API means that textlint and @textlint/kernel export modules.

Convert Public API testing:

textlint:

  • TextLintCore
  • TextFixEngine
  • TextLintEngine
  • textlint
  • cli

@textlint/kernel:

Related work: Behind the Scenes: Improving the Repository Infrastructure - React Blog

How to add tests?

@textlint/kernel and textlint has following test architecture.

  • Each Test is separated by directory
  • Each Test has fixtures directory

Colusion:

  • Add test
  • Run tests: yarn run test
  • Pass tests 💚

How to convert tests?

Example: refactor(textlint): Convert rule-loader-test.ts #370

  • Rename .js to .ts
  • Run tests: yarn run test
  • Pass tests 💚

Other examples: refactor(textlint): Convert textlint-core test to TypeScript #383

For more details, see also Contributing Guide.


❤️Love to pull request if you change one file!

@azu

This comment has been minimized.

Show comment
Hide comment
@azu

azu Dec 17, 2017

Member

📝 Note: When I'm converting cli-test.js, I've met unexpected error.
It is strange behavior. #392 (comment)

Member

azu commented Dec 17, 2017

📝 Note: When I'm converting cli-test.js, I've met unexpected error.
It is strange behavior. #392 (comment)

0x6b added a commit to 0x6b/textlint that referenced this issue Dec 26, 2017

refactor(kernel): convert ASTNodeTypes test to TypeScript
- Convert test case to TypeScript as part of textlint#369
- Add type definition to `ASTNodeTypes`
- Correct `main` and `types` properties in `package.json` to prevent
  module resolving issue at `@textlint/kernel`
- Add `clean` package script and dev dependency for build stability

0x6b added a commit to 0x6b/textlint that referenced this issue Dec 26, 2017

refactor(kernel): convert ASTNodeTypes test to TypeScript
- Convert test case to TypeScript as part of textlint#369
- Add type definition to `ASTNodeTypes`
- Correct `main` and `types` properties in `package.json` to prevent
  module resolving issue at `@textlint/kernel`
- Add `clean` package script and dev dependency for build stability

0x6b added a commit to 0x6b/textlint that referenced this issue Dec 26, 2017

refactor(ast-node-types): convert ASTNodeTypes test to TypeScript
- Convert test case to TypeScript as part of textlint#369
- Add type definition to `ASTNodeTypes`
- Correct `main` and `types` properties in `package.json` to prevent
  module resolving issue at `@textlint/kernel`
- Add `clean` package script and dev dependency for build stability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment