Skip to content

Commit 6216229

Browse files
committed
fix: updated packages and switched to jest
1 parent 4831092 commit 6216229

File tree

12 files changed

+21827
-11367
lines changed

12 files changed

+21827
-11367
lines changed

.circleci/config.yml

Lines changed: 0 additions & 58 deletions
This file was deleted.

.commitlintrc.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends:
2+
- "@commitlint/config-conventional"
3+
rules:
4+
body-max-line-length: [1, "always", 100]

.github/workflows/ci-cd.yaml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
branches:
8+
- main
9+
10+
jobs:
11+
lint-commits:
12+
if: github.event_name == 'pull_request'
13+
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
cache: "npm"
24+
- run: npm ci --ignore-scripts
25+
- run: npx commitlint --from HEAD~${{ github.event.pull_request.commits }} --to HEAD
26+
27+
build:
28+
runs-on: ubuntu-latest
29+
30+
strategy:
31+
matrix:
32+
# add/remove versions as we move support forward
33+
node-version: [16, 18]
34+
35+
steps:
36+
- uses: actions/checkout@v3
37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v3
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
cache: "npm"
42+
- run: npm ci
43+
- run: npm run lint
44+
- run: npm run test:unit
45+
46+
release:
47+
needs: build
48+
49+
# don't run on forks
50+
if: ${{ github.repository_owner == 'SmartThingsCommunity' && github.ref == 'refs/heads/main' }}
51+
52+
runs-on: ubuntu-latest
53+
54+
steps:
55+
- uses: actions/checkout@v3
56+
- name: Setup Node.js
57+
uses: actions/setup-node@v3
58+
with:
59+
node-version: 16
60+
cache: "npm"
61+
- run: npm ci
62+
- name: Release
63+
env:
64+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
65+
GITHUB_TOKEN: ${{ secrets.PI_GITHUB_TOKEN }}
66+
GIT_AUTHOR_NAME: smartthingspi
67+
GIT_AUTHOR_EMAIL: [email protected]
68+
GIT_COMMITTER_NAME: smartthingspi
69+
GIT_COMMITTER_EMAIL: [email protected]
70+
run: npx semantic-release

.github/workflows/codeql.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/workflows/stale.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Close stale issues
2+
3+
on:
4+
schedule:
5+
- cron: "30 1 * * *"
6+
7+
permissions:
8+
issues: write
9+
10+
jobs:
11+
stale:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/stale@v4
15+
with:
16+
stale-issue-message: "This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days."
17+
exempt-issue-labels: "reviewed"

.releaserc.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins:
2+
- "@semantic-release/commit-analyzer"
3+
- "@semantic-release/release-notes-generator"
4+
- "@semantic-release/github"
5+
- - "@semantic-release/changelog"
6+
- changelogFile: docs/CHANGELOG.md
7+
- "@semantic-release/npm"
8+
- - "@semantic-release/git"
9+
- assets: ["docs", "package.json"]
10+
message: "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
11+
preset: conventionalcommits
12+
branches:
13+
- main

config/jest.setup.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/* eslint no-undef: 'off' */
2+
3+
process.on('unhandledRejection', error => {
4+
fail(error)
5+
})

jest.config.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
// Currently unable to set coverage reporter watermarks in jest. See https://github.com/facebook/jest/issues/9734
3+
//
4+
// For our previous nyc watermark config, see
5+
// https://github.com/SmartThingsCommunity/smartapp-sdk-nodejs/blob/79983de15646dd3be84d2b3e82d409f9bc632959/package.json#L72
6+
collectCoverageFrom: ['lib/**/*.js'],
7+
coverageReporters: ['json', 'text'],
8+
testEnvironment: 'node',
9+
testPathIgnorePatterns: ['test/data', 'test/utilities'],
10+
testMatch: ['**/test/**/*.[jt]s?(x)'],
11+
setupFiles: ['<rootDir>/config/jest.setup.js']
12+
}

lib/dynamodb-context-store.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = class DynamoDBContextStore {
4040
*/
4141

4242
/**
43-
* Create a context store instance instance
43+
* Create a context store instance
4444
* @param {DynamoDBContextStoreOptions|Object} [options] Optionally, pass in a configuration object
4545
*/
4646
constructor(options = {}) {

0 commit comments

Comments
 (0)