Skip to content
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
11 changes: 9 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
{
"env": {
"commonjs": true,
"es2021": true,
"es2022": true,
"node": true
},
"extends": "eslint:recommended",
"globals": {
"fetch": "readonly",
"FormData": "readonly",
"Headers": "readonly",
"Request": "readonly",
"Response": "readonly"
},
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 12
"ecmaVersion": "latest"
},
"root": true,
"rules": {
Expand Down
39 changes: 19 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,29 @@ on:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
issues: write
pull-requests: write
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Semantic Release
id: release
uses: cycjimmy/semantic-release-action@v3

- name: Install dependencies
run: npm ci

- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.OSS_NPM_TOKEN }}
with:
extra_plugins: |
@semantic-release/changelog@6
@semantic-release/git@10
- name: Teams notification
uses: toko-bifrost/ms-teams-deploy-card@3.1.2
if: always()
with:
github-token: ${{ github.token }}
webhook-uri: ${{ secrets.TEAMS_WEBHOOK_URI }}
show-on-start: false
card-layout-exit: complete
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: true
4 changes: 2 additions & 2 deletions .github/workflows/validate-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v6
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16
22
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,38 @@ npm test -- MyTestableUnit
```
This is a shortcut for `npm test -- --testFileName=MyTestableUnit`

### CLI flags

| Flag | Description |
|------|-------------|
| `--testFileName=<name>` | Run only tests whose file name matches `<name>` |
| `--forceConnect` | Before deploying, kill any local process connected to port 8085 and proceed (see below) |

### Port 8085 and debug session behaviour

Roku exposes a debug console on **port 8085**. Only one client can be connected at a time.

**Default behaviour (no flags)**

`npm test` always builds and deploys. After deployment, it connects to port 8085 to read results. If another client is already connected (e.g. a developer monitoring logs with `telnet` or `nc`), the run **fails immediately** with:

```
Console port 8085 is occupied by another client. Close the existing connection or run with --forceConnect to break it.
```

Close the existing connection and re-run, or use `--forceConnect`.

**`--forceConnect`**

Before deploying, the test runner finds any local process connected to port 8085 (via `lsof`) and kills it, freeing the port. Build → deploy → connect then proceed normally.

```shell
npm test -- --forceConnect
npm test -- --testFileName=MyUnit --forceConnect
```

Use this when you intentionally want to take over the debug port regardless of who else is connected.

## Kopytko Unit Test Philosophy

The unit tests can be split into multiple files and imported by the packager automatically. Let's consider the following example:
Expand Down
Loading