tools icon indicating copy to clipboard operation
tools copied to clipboard

☂️ Missing Tests

Open jer3m01 opened this issue 6 years ago • 26 comments

List of all missing tests that need to be done.

  • [x] ast-utils/removeLoc.ts
  • [x] codec-js-regexp/index.ts
  • [x] codec-source-map/ArraySet.ts @nt591
  • [x] codec-source-map/base64.ts
  • [x] codec-source-map/MappingList.ts
  • [x] codec-source-map/SourceMapConsumer.ts
  • [x] codec-source-map/SourceMapConsumerCollection.ts
  • [x] codec-source-map/SourceMapGenerator.ts
  • [x] js-ast-utils/assertMultipleNodes.ts @aravind1078
  • [x] js-ast-utils/assertSingleNode.ts @aravind1078
  • [x] js-ast-utils/assertSingleOrMultipleNodes.ts @aravind1078
  • [x] js-ast-utils/cleanJSXText.ts
  • [x] js-ast-utils/createMemberProperty.ts
  • [x] js-ast-utils/createPropertyKey.ts
  • [x] js-ast-utils/getBindingIdentifiers.ts
  • [x] js-ast-utils/getImportSpecifiers.ts
  • [x] js-ast-utils/getJSXAttribute.ts
  • [x] js-ast-utils/getJSXElementName.ts @aravind1078
  • [x] js-ast-utils/getTSQualifiedBaseFromEntityName.ts
  • [x] js-ast-utils/hasJSXAttribute.ts
  • [x] js-ast-utils/hasPotentialSideEffects.ts
  • [x] js-ast-utils/inheritLoc.ts
  • [x] js-ast-utils/isBinary.ts @nt591
  • [x] js-ast-utils/isEmptyTemplateLiteral.ts
  • [x] js-ast-utils/isFunctionNode.ts @aravind1078
  • [x] js-ast-utils/isInTypeAnnotation.ts
  • [x] js-ast-utils/isJSXElement.ts @aravind1078
  • [x] js-ast-utils/isNodeLike.ts @sasurau4
  • [x] js-ast-utils/isValidIdentifierName.ts
  • [x] js-ast-utils/removeShallowLoc.ts
  • [x] js-ast-utils/renameBindings.ts
  • [x] js-ast-utils/resolveIndirection.ts
  • [x] js-ast-utils/template.ts
  • [x] js-ast-utils/tryStaticEvaluation.ts @nt591
  • [x] js-ast-utils/tryStaticEvaluationPath.ts @nt591
  • [x] js-ast-utils/valueToNode.ts @gie3d
  • [x] markup-syntax-hightlight/index.ts @JustBeYou
  • [x] parser-core/comments.ts
  • [x] parser-core/ParserCore.ts
  • [x] parser-core/utils.ts
  • [x] path-match/stringify.ts @JustBeYou
  • [x] string-diff/index.ts @JustBeYou
  • [x] vcs/index.ts @JustBeYou

If any of them are not worth having test or some are missing, please comment.

A ⚙️ indicates they are being worked on. A checkmark indicates an open PR.

jer3m01 avatar Aug 10 '20 15:08 jer3m01

I'm going to look into js-ast-utils/isBinary.ts now

nt591 avatar Aug 12 '20 18:08 nt591

I'm adding tests for js-ast-utils/isFor

nt591 avatar Aug 13 '20 16:08 nt591

I'm also adding tests for codec-source-map/ArraySet.ts

Should I start collapsing these posts into one and edit accordingly?

nt591 avatar Aug 13 '20 20:08 nt591

Sorry I didn't have time to review the list of tests in the issue body. We don't need tests for basic methods that are just refining types, they are extremely excessive and will be implicitly integration tested elsehwere.

sebmck avatar Aug 13 '20 20:08 sebmck

@nt591 Feel free to batch them up into a single PR, whatever's easiest. If you're only adding new files then you shouldn't need to worry about merge conflcits at all! Thank you for doing this work!

sebmck avatar Aug 13 '20 20:08 sebmck

Also when implementing any tests that operate on an AST, preferably inline the AST itself by manually constructing it with the create builder methods in @internal/ast, and if you really need to parse JS (such as a large example), use:

import {parseJS} from "@internal/js-parser";

parseJS({
  input: "CODE HERE",
  path: "unknown",
);

sebmck avatar Aug 13 '20 20:08 sebmck

@nt591 and I started in on js-ast-utils/isUnaryLike.ts

Does the strikethrough mean it's one of the unneeded "basic methods that are just refining types" to be tested elsewhere?

We noticed throw is a JSThrowStatement not a UnaryExpression.

hanhanhan avatar Aug 14 '20 00:08 hanhanhan

~~Yes the strikethrough means a test for it isn't needed. I'll add that the the description.~~

They've been removed.

jer3m01 avatar Aug 14 '20 00:08 jer3m01

i'm going to look into js-ast-utils/isJsxElement

iaravindreddyp avatar Aug 14 '20 08:08 iaravindreddyp

I will take js-ast-utils/assertMultipleNodes.ts js-ast-utils/assertSingleNode.ts js-ast-utils/assertSingleOrMultipleNodes.ts and try to batch them together bcz all of them looks fairly similar

iaravindreddyp avatar Aug 15 '20 12:08 iaravindreddyp

@hanhanhan

We noticed throw is a JSThrowStatement not a UnaryExpression.

Oh that's really bizzare, that shouldn't be there... Want to open a PR to remove it? TypeScript checks should be enough to validate it's not used anywhere.

sebmck avatar Aug 15 '20 22:08 sebmck

Thank you so much everyone for the PRs! I really appreciate it, especially since you've all written them without any context. I've long neglected tests for most of the code I've written since it's been a colossal effort to build it in the first place.

sebmck avatar Aug 15 '20 23:08 sebmck

I think I will give a try to the things under js-ast-utils:

  • markup-syntax-hightlight/index.ts
  • parser-core/comments.ts
  • parser-core/ParserCore.ts
  • parser-core/utils.ts
  • string-diff/index.ts
  • vcs/index.ts

JustBeYou avatar Aug 17 '20 06:08 JustBeYou

i will give a try at js-ast-utils/isFunctionNode

iaravindreddyp avatar Aug 18 '20 03:08 iaravindreddyp

will try js-ast-utils/getJsxElementName as well

iaravindreddyp avatar Aug 18 '20 13:08 iaravindreddyp

I'd like to take

js-ast-utils/tryStaticEvaluation.ts js-ast-utils/tryStaticEvaluationPath.ts

nt591 avatar Aug 18 '20 18:08 nt591

@hanhanhan

We noticed throw is a JSThrowStatement not a UnaryExpression.

Oh that's really bizzare, that shouldn't be there... Want to open a PR to remove it? TypeScript checks should be enough to validate it's not used anywhere.

Here it is! https://github.com/romefrontend/rome/pull/1138

hanhanhan avatar Aug 21 '20 19:08 hanhanhan

I'll work on js-ast-utils/isNodeLike.ts.

sasurau4 avatar Aug 26 '20 13:08 sasurau4

I'll take js-ast-utils/isTypeNode.ts

unvalley avatar Sep 25 '20 11:09 unvalley

I'll try js-ast-utils/valueToNode.ts

gie3d avatar Dec 10 '20 05:12 gie3d