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

Add dist files, bundler integration tests #74

Closed
wants to merge 2 commits into from

Conversation

katelynsills
Copy link
Contributor

@katelynsills katelynsills commented Mar 8, 2019

Still in progress, bugs remain

Description

This PR builds on #68 and generates three different dist files with rollup - an ES6 module version, a CommonJS version, and a UMD version. These are listed under pkg.module, pkg.main, and pkg.browser respectively.

This PR adds integration tests that run automatically with CircleCI to test that SES's dist files are usable with the main JavaScript bundlers and tools. We test SES with Webpack, Browserify, Rollup, Parcel, and a mocked version of what unpkg would provide after publishing the latest version to npm. There is a README.md in /integration-test with more detailed information.

Current Bugs

  1. Webpack and Parcel seem to rename SES such that when a function that includes a call to SES is run within SES, it throws a ReferenceError. We may be able to turn this renaming off.

screen shot 2019-03-07 at 5 15 53 pm

screen shot 2019-03-07 at 5 15 42 pm

2. Right now the bundlers will error when they try to bundle our tests of the require() functionality because the bundler will not be able to find the modules unknown and foo As a partial fix, the test-require.js tests are not included in the test suite run by webpack and parcel, but they are tested in rollup, browserify, and unpkg. This prevents this error entirely, but it does mean that we will not catch future error related to the require functionality in webpack and parcel.

Considerations

We still need to test using the ES6 module version directly in the browser with type="module". This seems to require spinning up a small server on CircleCI.

Tests

  • npm test to make sure normal tests still pass
  • npm run build to build the dist files
  • check that the dist files are ignored by git and eslint
  • npm pack to check that the dist files are included in the npm tarball
  • test the test_integration job locally with the CircleCI command line tool: circleci local execute --job test_integration

@katelynsills katelynsills added the bug Something isn't working label Mar 8, 2019
@katelynsills katelynsills requested a review from warner March 8, 2019 02:17
@katelynsills katelynsills force-pushed the bundler-integration-tests branch from 11f7e94 to bb85dc3 Compare March 12, 2019 00:29
@warner
Copy link
Member

warner commented Mar 13, 2019

  1. Right now the bundlers will error when they try to bundle our tests of the require() functionality because the bundler will not be able to find the modules unknown and foo

We might try doing a const require2 = require; require2('unknown'). That trick may not work depending on how smart the bundling tools are, but it's worth a shot.

@katelynsills
Copy link
Contributor Author

With the Realms shim fix, now works entirely with Browserify, Rollup, and the mock version of unpkg.

@katelynsills katelynsills force-pushed the bundler-integration-tests branch from b99f90d to 2e3ec9d Compare March 26, 2019 02:02
@katelynsills katelynsills force-pushed the bundler-integration-tests branch from 2e3ec9d to 099ca4a Compare March 26, 2019 02:04
@katelynsills
Copy link
Contributor Author

Replaced by #97

@katelynsills katelynsills deleted the bundler-integration-tests branch March 28, 2019 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants