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

maint: add dev notes and update smoke test #28

Merged
merged 3 commits into from
Jan 23, 2024
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
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 @@ -157,22 +157,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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running the smoke tests locally the tests would fail with a timeout, so I picked an arbitrary number for now and it's been more reliable

e2e: {
setupNodeEvents() {
// implement node event listeners here
Expand Down