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

[WIP] Run tests in CI #45

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

[WIP] Run tests in CI #45

wants to merge 4 commits into from

Commits on Nov 24, 2023

  1. Convert to ES modules

    We expose an ES module version of the library for module bundlers to
    use, and generate a CommonJS version for Node.
    
    The motivation is that, for [1] I want to re-export this library from
    ably-js as a tree-shakable module. Tree-shakability requires that we use
    ES modules.
    
    I’ve output the Node bundle to a new `build` directory, since I don’t
    know whether the `dist` directory has some special meaning for the
    `ably-env deploy` script and so didn’t want to put non-CDN stuff in
    there.
    
    The version of Node that the README tells us to use does not support ES
    modules, so we generate a CommonJS bundle for the tests to use, which
    includes all of the internal components so that they can be tested.
    
    I tested these changes for regressions by:
    
    1. running `npm run grunt -- test:node`
    2. running `npm run grunt -- test:browser:local`
    3. generating an NPM package using `npm pack`, installing it in ably-js,
       and running the delta tests there
    
    [1] ably/ably-js#1492
    lawrence-forooghian committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    9d8aeb8 View commit details
    Browse the repository at this point in the history
  2. Convert everything to ES classes

    Motivation as in 9d8aeb8, and tested in the same way.
    
    I don’t know exactly _what_ about the non-class way of doing things made
    it not be tree-shakable; I can only speculate that it was the
    `.prototype.foo = ...` statements.
    
    The update to Babel is because the version we were using didn’t support
    class fields.
    lawrence-forooghian committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    63584ed View commit details
    Browse the repository at this point in the history
  3. Make errors.js’s export tree-shakable

    Motivation as in 9d8aeb8.
    lawrence-forooghian committed Nov 24, 2023
    Configuration menu
    Copy the full SHA
    9a0cd73 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    0fd945b View commit details
    Browse the repository at this point in the history