Skip to content

Commit

Permalink
Merge pull request #28 from honeycombio/jamie.dev-and-local-setup
Browse files Browse the repository at this point in the history
maint: add dev notes and update smoke test
- Add dedicated DEVELOPING.md for local dev setup and notes, and reference that section in the README. Also update links in README for other docs.
- Sometimes the console output takes longer than the default timeout of 4000ms, so update Cypress config to timeout at 10000ms instead.
  • Loading branch information
JamieDanielson authored Jan 23, 2024
2 parents 109adae + ddf20e0 commit 64e0888
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 12 deletions.
69 changes: 69 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Local Development

## Prerequisites

**Required:**

- Node.js (minimum version declared in package.json)

**Recommended:**

- VSCode Plugins:
- ESLint (dbaeumer.vscode-eslint)
- Prettier (esbenp.prettier-vscode)
- Prettier ESLint (rvest.vs-code-prettier-eslint)
- Docker - Required for running smoke-tests.
- [Docker Desktop](https://www.docker.com/products/docker-desktop/) is a reliable choice if you don't have your own preference.

## Main Commands

```shell
# install all dependencies from package.json
npm install

# compile the typescript source to javascript in a dist directory
npm run build

# prettier will specify files that need formatting changes
npm run check-format

# eslint will specify files that have linting errors
npm run lint

# run unit tests with jest
npm run test
```

## Smoke Tests

Smoke tests currently use Cypress and Docker, and rely on console output.

```sh
# run smoke tests with cypress and docker
npm run test:smoke
```

If it doesn't clean up properly afterward, manually tear it down:

```sh
npm run clean:smoke-test-example
```

## Example Application

The example app uses a local install of the root directory's code, so make sure that is built first.

```sh
# navigate to example app
cd ./examples/hello-world-web

# install dependencies, including local source package
npm install

# add api key into index.js

# bundle and run example in watch mode to update when source changes
npm run dev
```

To see output in the console in the browser, be sure to enable the console level Verbose in Console Dev Tools.
18 changes: 6 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Install this library:

Initialize tracing at the start of your application:

```
```js
import { HoneycombWebSDK } from '@honeycombio/opentelemetry-web';
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web';

Expand Down Expand Up @@ -76,7 +76,7 @@ Pass these options to the HoneycombWebSDK:
In production, we recommend running an OpenTelemetry Collector, so that your browser app can send traces to its origin.
Your OpenTelemetry Collector can send the traces on to Honeycomb, and your API key will be in the Collector's configuration. Here is a configuration of the Honeycomb Web SDK that sends to your Collector:

```
```js
{
endpoint: "/",
serviceName: "your-spiffy-browser-application",
Expand Down Expand Up @@ -163,22 +163,16 @@ When an option is not available upstream, we give it a name. If that options bec

## Development

### Tests

To run smoke tests, make sure you have docker installed and run

```sh
npm run test:smoke
```
See [DEVELOPING.md](./DEVELOPING.md)

## Contributing

See [CONTRIBUTING.md]()
See [CONTRIBUTING.md](./CONTRIBUTING.md)

## Support

See [SUPPORT.md]()
See [SUPPORT.md](./SUPPORT.md)

## Code of Conduct

See [CODE_OF_CONDUCT.md]()
See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
1 change: 1 addition & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'cypress';

export default defineConfig({
defaultCommandTimeout: 10000, // default is 4000
e2e: {
setupNodeEvents() {
// implement node event listeners here
Expand Down

0 comments on commit 64e0888

Please sign in to comment.