Skip to content

Commit

Permalink
Merge branch 'main' into nahuelon/gh-800/deps-bad-reference-error
Browse files Browse the repository at this point in the history
  • Loading branch information
tnolet authored Nov 28, 2023
2 parents f39c056 + 8a18ddc commit b77d252
Show file tree
Hide file tree
Showing 73 changed files with 1,021 additions and 294 deletions.
6 changes: 0 additions & 6 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,5 @@ module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'header-max-length': [2, 'always', 100],
'references-empty': [1, 'never'],
},
parserPreset: {
parserOpts: {
issuePrefixes: ['gh', 'sc'],
},
},
}
28 changes: 0 additions & 28 deletions examples/advanced-project-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,6 @@ npm create checkly -- --template advanced-project

This project mimics a typical app where you organize code with top-level defaults and per page, service or component checks.

```
.
├── .github
│   └── workflow.yml
├── README.md
├── checkly.config.js
├── package.json
└── src
├── __checks__
│   ├── api.check.js
│   ├── home.check.js
│   ├── homepage.spec.js
│   ├── login.spec.js
│   ├── utils
│   │   ├── auth-client.js
│   │   └── setup.js
│   └── website-group.check.js
├── alert-channels.js
├── defaults.js
└── services
├── api
│   └── __checks__
│   └── api.check.js
└── top-sellers
└── __checks__
└── top-sellers.spec.js
```

- Running `npx checkly test` will look for `.check.js` files and `.spec.js` in `__checks__` directories and execute them in a dry run.

- Running `npx check deploy` will deploy your checks to Checkly, attach alert channels, and run them on a 10m schedule in the
Expand Down
7 changes: 5 additions & 2 deletions examples/advanced-project-js/checkly.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { defineConfig } = require('checkly');
const { RetryStrategyBuilder } = require('checkly/constructs');

/**
* See https://www.checklyhq.com/docs/cli/project-structure/
Expand All @@ -10,8 +11,8 @@ const config = defineConfig({
* See https://www.checklyhq.com/docs/cli/constructs/ to learn more about logical IDs.
*/
logicalId: 'advanced-example-project',
/* An optional URL to your Git repo */
repoUrl: 'https://github.com/checkly/checkly-cli',
/* An optional URL to your Git repo to be shown in your test sessions and resource activity log */
/* repoUrl: 'https://github.com/checkly/checkly-cli', */
/* Sets default values for Checks */
checks: {
/* A default for how often your Check should run in minutes */
Expand All @@ -24,6 +25,8 @@ const config = defineConfig({
* See https://www.checklyhq.com/docs/cli/npm-packages/
*/
runtimeId: '2023.02',
/* Failed check runs will be retried before triggering alerts */
retryStrategy: RetryStrategyBuilder.fixedStrategy({ baseBackoffSeconds: 60, maxRetries: 4, sameRegion: true }),
/* A glob pattern that matches the Checks inside your repo, see https://www.checklyhq.com/docs/cli/using-check-test-match/ */
checkMatch: '**/__checks__/**/*.check.js',
browserChecks: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const { HeartbeatCheck } = require('checkly/constructs')

/* new HeartbeatCheck('heartbeat-check-1', {
name: 'Send weekly newsletter job',
period: 30,
periodUnit: 'minutes',
grace: 10,
period: 1,
periodUnit: 'hours',
grace: 30,
graceUnit: 'minutes',
})
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as path from 'path'
import { MultiStepCheck } from 'checkly/constructs'
import { smsChannel, emailChannel } from '../alert-channels'

const alertChannels = [smsChannel, emailChannel]

/*
* In this example, we utilize the SpaceX public API to construct a series of chained requests, with the goal of confirming
* that the capsules retrieved from the main endpoint match those obtained from the individual capsule endpoint.
* Read more in our documentation https://www.checklyhq.com/docs/multistep-checks/
*/

// We can define multiple checks in a single *.check.js file.
new MultiStepCheck('spacex-multistep-check', {
name: 'SpaceX MS',
runtimeId: '2023.09',
alertChannels,
code: {
entrypoint: path.join(__dirname, 'spacex-requests.spec.js')
},
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test, expect } from '@playwright/test'

const baseUrl = 'https://api.spacexdata.com/v3'

test('space-x dragon capsules', async ({ request }) => {
/**
* Get all SpaceX Dragon Capsules
*/
const [first] = await test.step('get all capsules', async () => {
const response = await request.get(`${baseUrl}/dragons`)
expect(response).toBeOK()

const data = await response.json()
expect(data.length).toBeGreaterThan(0)

return data
})

/**
* Get a single Dragon Capsule
*/
await test.step('get single dragon capsule', async () => {
const response = await request.get(`${baseUrl}/dragons/${first.id}`)
expect(response).toBeOK()

const dragonCapsule = await response.json()
expect(dragonCapsule.name).toEqual(first.name)
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { CheckGroup } = require('checkly/constructs');
const { CheckGroup, RetryStrategyBuilder } = require('checkly/constructs');
const { smsChannel, emailChannel } = require('../alert-channels');
const alertChannels = [smsChannel, emailChannel];
/*
Expand All @@ -24,6 +24,11 @@ const websiteGroup = new CheckGroup('website-check-group-1', {
apiCheckDefaults: {},
concurrency: 100,
alertChannels,
/*
* Failed check runs in this group will be retried before triggering alerts.
* The wait time between retries will increase linearly: 30 seconds, 60 seconds, and then 90 seconds between the retries.
*/
retryStrategy: RetryStrategyBuilder.linearStrategy({ baseBackoffSeconds: 30, maxRetries: 3, sameRegion: false }),
});

module.exports = websiteGroup;
module.exports = { websiteGroup };
28 changes: 0 additions & 28 deletions examples/advanced-project/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,6 @@ npm create checkly -- --template advanced-project

This project mimics a typical app where you organize code with top-level defaults and per page, service or component checks.

```
.
├── .github
│   └── workflow.yml
├── README.md
├── checkly.config.ts
├── package.json
└── src
├── __checks__
│   ├── api.check.ts
│   ├── home.check.ts
│   ├── homepage.spec.ts
│   ├── login.spec.ts
│   ├── utils
│   │   ├── auth-client.ts
│   │   └── setup.ts
│   └── website-group.check.ts
├── alert-channels.ts
├── defaults.ts
└── services
├── api
│   └── __checks__
│   └── api.check.ts
└── top-sellers
└── __checks__
└── top-sellers.spec.ts
```

- Running `npx checkly test` will look for `.check.ts` files and `.spec.ts` in `__checks__` directories and execute them in a dry run.

- Running `npx check deploy` will deploy your checks to Checkly, attach alert channels, and run them on a 10m schedule in the
Expand Down
7 changes: 5 additions & 2 deletions examples/advanced-project/checkly.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig } from 'checkly'
import { RetryStrategyBuilder } from 'checkly/constructs'

/**
* See https://www.checklyhq.com/docs/cli/project-structure/
Expand All @@ -10,8 +11,8 @@ const config = defineConfig({
* See https://www.checklyhq.com/docs/cli/constructs/ to learn more about logical IDs.
*/
logicalId: 'advanced-example-project',
/* An optional URL to your Git repo */
repoUrl: 'https://github.com/checkly/checkly-cli',
/* An optional URL to your Git repo to be shown in your test sessions and resource activity log */
/* repoUrl: 'https://github.com/checkly/checkly-cli', */
/* Sets default values for Checks */
checks: {
/* A default for how often your Check should run in minutes */
Expand All @@ -24,6 +25,8 @@ const config = defineConfig({
* See https://www.checklyhq.com/docs/cli/npm-packages/
*/
runtimeId: '2023.02',
/* Failed check runs will be retried before triggering alerts */
retryStrategy: RetryStrategyBuilder.fixedStrategy({ baseBackoffSeconds: 60, maxRetries: 4, sameRegion: true }),
/* A glob pattern that matches the Checks inside your repo, see https://www.checklyhq.com/docs/cli/using-check-test-match/ */
checkMatch: '**/__checks__/**/*.check.ts',
browserChecks: {
Expand Down
6 changes: 3 additions & 3 deletions examples/advanced-project/src/__checks__/heartbeat.check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { HeartbeatCheck } from 'checkly/constructs'

/* new HeartbeatCheck('heartbeat-check-1', {
name: 'Send weekly newsletter job',
period: 30,
periodUnit: 'minutes',
grace: 10,
period: 1,
periodUnit: 'hours',
grace: 30,
graceUnit: 'minutes',
})
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as path from 'path'
import { MultiStepCheck } from 'checkly/constructs'
import { smsChannel, emailChannel } from '../alert-channels'

const alertChannels = [smsChannel, emailChannel]

/*
* In this example, we utilize the SpaceX public API to construct a series of chained requests, with the goal of confirming
* that the capsules retrieved from the main endpoint match those obtained from the individual capsule endpoint.
* Read more in our documentation https://www.checklyhq.com/docs/multistep-checks/
*/

// We can define multiple checks in a single *.check.ts file.
new MultiStepCheck('spacex-multistep-check', {
name: 'SpaceX MS',
runtimeId: '2023.09',
alertChannels,
code: {
entrypoint: path.join(__dirname, 'spacex-requests.spec.ts')
},
})
29 changes: 29 additions & 0 deletions examples/advanced-project/src/__checks__/spacex-requests.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { test, expect } from '@playwright/test'

const baseUrl = 'https://api.spacexdata.com/v3'

test('space-x dragon capsules', async ({ request }) => {
/**
* Get all SpaceX Dragon Capsules
*/
const [first] = await test.step('get all capsules', async () => {
const response = await request.get(`${baseUrl}/dragons`)
expect(response).toBeOK()

const data = await response.json()
expect(data.length).toBeGreaterThan(0)

return data
})

/**
* Get a single Dragon Capsule
*/
await test.step('get single dragon capsule', async () => {
const response = await request.get(`${baseUrl}/dragons/${first.id}`)
expect(response).toBeOK()

const dragonCapsule = await response.json()
expect(dragonCapsule.name).toEqual(first.name)
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CheckGroup } from 'checkly/constructs'
import { CheckGroup, RetryStrategyBuilder } from 'checkly/constructs'
import { smsChannel, emailChannel } from '../alert-channels'
const alertChannels = [smsChannel, emailChannel]
/*
Expand All @@ -24,4 +24,9 @@ export const websiteGroup = new CheckGroup('website-check-group-1', {
apiCheckDefaults: {},
concurrency: 100,
alertChannels,
/*
* Failed check runs in this group will be retried before triggering alerts.
* The wait time between retries will increase linearly: 30 seconds, 60 seconds, and then 90 seconds between the retries.
*/
retryStrategy: RetryStrategyBuilder.linearStrategy({ baseBackoffSeconds: 30, maxRetries: 3, sameRegion: false }),
})
6 changes: 3 additions & 3 deletions examples/boilerplate-project-js/__checks__/heartbeat.check.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ const { HeartbeatCheck } = require('checkly/constructs')

/* new HeartbeatCheck('heartbeat-check-1', {
name: 'Send weekly newsletter job',
period: 30,
periodUnit: 'minutes',
grace: 10,
period: 1,
periodUnit: 'hours',
grace: 30,
graceUnit: 'minutes',
})
*/
Expand Down
6 changes: 3 additions & 3 deletions examples/boilerplate-project/__checks__/heartbeat.check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { HeartbeatCheck } from 'checkly/constructs'

/* new HeartbeatCheck('heartbeat-check-1', {
name: 'Send weekly newsletter job',
period: 30,
periodUnit: 'minutes',
grace: 10,
period: 1,
periodUnit: 'hours',
grace: 30,
graceUnit: 'minutes',
})
*/
Expand Down
Loading

0 comments on commit b77d252

Please sign in to comment.