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

Refactor build-default tests for more explicitness and correctness checks #903

Merged
merged 5 commits into from
Oct 14, 2020

Commits on Oct 13, 2020

  1. refactor: move unbundled regenerator test to build-options

    - I accidentally put it into build-default before build-options existed,
      but the test very specifically tests an option, `--target node`, so
      it should be in build-options as that's not a zero-config default
    agilgur5 committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    2267a9f View commit details
    Browse the repository at this point in the history
  2. refactor: use a less noisy side-effect for async regression test

    - the previous console.log statement would actually log out because
      one of the tests imports (`require`s) the actual built library in
      order to ensure correctness
      - during the import, the side-effect runs and prints, which ends up
        actually printing out during the test, which was quite noisy 😅
    
    - we do still want a side-effect so the whole statement doesn't get
      removed as dead code, so use a global variable assignment instead
    agilgur5 committed Oct 13, 2020
    Configuration menu
    Copy the full SHA
    3a3a0fb View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2020

  1. refactor: be more descriptive than "blah", "foo", "bar" in tests

    - instead of random names (which are bad practice), be very explicit
      about what the variables _should_ be
    - also add comments to some of the regression tests that didn't have
      any to describe them
    
    - similarly, when testing dev only logging, say that directly
      - and, in this case, instead of using an unnecessary swear word
        - the third contributor PR to TSDX removed some similar swear words
          in the templates
          - these were changed to "boop" and now similarly changed to be
            more descriptive
            - which is better practice anyway, not encouraging bad practices
              via the templates, and should also be easier to understand for
              newcomers
    
    - similarly, intead of "blah" and "works" in template tests, actually
      describe what the tests do
      - similarly encourage better practices in the tests
    
    - also rename template tests from "blah.test.ts" to "index.test.ts"
      because they test "index.ts" and it's common convention to name them
      the same
    
    - and fix a leftover "describe('it')" in the react template when it
      should be "describe('Thing')" which the storybook template has
      - "it" is also confusing when used together with the Jest "it" global
      - could use something better than "Thing" as well (e.g.
        "SomeComponent"), but don't want to dig through and re-test the
        Storybook pieces right now
    agilgur5 committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    6ba8c8c View commit details
    Browse the repository at this point in the history
  2. fix/docs: basic README should reference .ts, not .tsx files

    - it uses normal .ts files and no JSX (that's what the React template
      is for after all), so README shouldn't mention .tsx
    
    - woops, this was probably a copy+paste error on my behalf when I was
      improving the basic template's docs
    agilgur5 committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    2c8b9a0 View commit details
    Browse the repository at this point in the history
  3. refactor/test: test for correctness of syntax, not just parsing

    - have most of the syntax tests export a function that returns true
      if the syntax is evaluated correctly, and test that it does in fact
      return true
      - just using `true` as something consistent and easy to test for
    
    - change the async test to move the side effect before the Promise
      resolves
      - not entirely sure why, potentially because of the way the event
        loop works (race condition), but this was returning false when
        after and true when before
        - both work as a side effect, so just have it before
    agilgur5 committed Oct 14, 2020
    Configuration menu
    Copy the full SHA
    019bee9 View commit details
    Browse the repository at this point in the history