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

fix: Revert type=module change #357

Merged
merged 2 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ You can run unit tests locally using `npm run test:unit` which spawns Chrome
(optionally from the `CHROME_BIN` envvar) using Karma, but we also run these
unit tests from an integration test (piggy-backing on the browser-spawning)
which you can run with `npm run test:integration -- --spec
test/unit/unit.spec.js` (see below for running integration tests).
test/unit/unit.spec.mjs` (see below for running integration tests).

Running `test/server.js` will give you an ngrok URL through which you can access
Running `test/server.mjs` will give you an ngrok URL through which you can access
the Mocha unit test page in any browser. Use this if you want to step through
using a remote browser.

Expand Down Expand Up @@ -128,7 +128,7 @@ Before running integration tests you will need authentication credentials to
connect to [BrowserStack](https://automate.browserstack.com/) which runs the
browsers we test in. Ask for help from a Ravelin engineer.

To run integration tests in test/\*/\*.spec.js:
To run integration tests in test/\*/\*.spec.mjs:

export BROWSERSTACK_USERNAME=u BROWSERSTACK_ACCESS_KEY=x
npm install
Expand All @@ -148,20 +148,20 @@ These environment variables can be used to configure what gets run:

### Process

Integration tests in test/\*/\*.spec.js run under
Integration tests in test/\*/\*.spec.mjs run under
[WebdriverIO](https://webdriver.io/) in Node using its `browser` to instruct a
real browser run by BrowserStack to perform actions like navigation to URLs,
clicking buttons, and pressing keys. The configuration lives in
[test/wdio.conf.js](./test/wdio.conf.js) and the process is as follows:
[test/wdio.conf.mjs](./test/wdio.conf.mjs) and the process is as follows:

1. `npm run test:integration` is called by the user.
2. `wdio test/wdio.conf.js` is invoked by npm.
3. `test/server.js` is run in the background by wdio. This serves the files in
2. `wdio test/wdio.conf.mjs` is invoked by npm.
3. `test/server.mjs` is run in the background by wdio. This serves the files in
test and offers a fake API implementation at /z and /z/err, and a /requests
endpoint for introspecting what API requests have been made.
4. A BrowserStack tunnel is pointed at `test/server.js`'s HTTP server. We use
4. A BrowserStack tunnel is pointed at `test/server.mjs`'s HTTP server. We use
this tunnel for default testing because there are no usage limits.
5. An ngrok tunnel is pointed at `test/server.js`. This alternative tunnel
5. An ngrok tunnel is pointed at `test/server.mjs`. This alternative tunnel
allows us to create cross-origin scenarios. Ngrok has limits on the number of
clients that can connect so you may need to authenticate with `ngrok
authtoken`.
Expand Down Expand Up @@ -271,35 +271,35 @@ tl;dr: ./lib for real code; ./test for test code.
│ │ example spec test.
│ │
│ ├── encrypt
│ │   ├── encrypt.spec.js
│ │   ├── encrypt.spec.mjs
│ │   └── index.html
│ ├── send
│ │   ├── index.html
│ │   └── send.spec.js
│ │   └── send.spec.mjs
│ ├── track
│ │   ├── index.html
│ │   └── track.spec.js
│ │   └── track.spec.mjs
│ ├── unit
│ │ │ Runs the ./test/*.test.js mocha tests in-browser, similar to Karma.
│ │   ├── index.html
│ │   └── unit.spec.js
│ │   └── unit.spec.mjs
│ │
│ │── wdio.conf.js
│ │── wdio.conf.mjs
│ │ Points webdriverio at the browsers and spec tests to run, and
│ │ configures the local test/server.js and BrowserStack tunnel.
│ │
│ ├── server.js
│ ├── server.mjs
│ │ An executable JS file which creates an express server listening on a
│ │ local port with public ngrok tunnel. It acts as a local ./test file
│ │ server with a fake Ravelin API on /z and /z/err and a request
│ │ introspection endpoint at /requests. Used during integration tests
│ │ to ensure that the browser under their control made a certain HTTP
│ │ request.
│ │
│ ├── common.spec.js
│ │ Helpers for node *.spec.js tests.
│ ├── ci.js
│ │ Utilities used when running wdio.conf.js in CI, such as
│ ├── common.spec.mjs
│ │ Helpers for node *.spec.mjs tests.
│ ├── ci.mjs
│ │ Utilities used when running wdio.conf.mjs in CI, such as
│ │ updating GitHub with progress messages.
│ ├── style.css
│ │ Shared style for integration test pages.
Expand Down
Loading