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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:

steps:
- uses: actions/[email protected]
- name: Use Node.js 18
- name: Use Node.js
uses: actions/[email protected]
with:
node-version: 18
node-version-file: ".nvmrc"
- run: npm install
- run: npm test
2 changes: 1 addition & 1 deletion .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/[email protected]
- uses: actions/[email protected]
with:
node-version: 18
node-version-file: ".nvmrc"
- run: npm install
- run: npm test

Expand Down
3 changes: 0 additions & 3 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# https://github.com/mochajs/mocha/blob/master/example/config/.mocharc.yml
require:
- ts-node/register
- reify
timeout: 100
watch-files:
- "lib/*.ts"
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18
lts/iron
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,22 @@
"scripts": {
"watch": "tsc --watch",
"build": "tsc && rollup -c",
"test": "tsc && prettier --check . && mocha",
"test": "tsc && prettier --check . && mocha --loader=ts-node/esm",
"format": "prettier --write .",
"prepublishOnly": "rm -rf dist && yarn build && npm test"
},
"author": "Paulus Schoutsen <[email protected]>",
"license": "Apache-2.0",
"devDependencies": {
"@types/assert": "^1.4.7",
"@types/mocha": "^9.0.0",
"@types/mocha": "^10.0.9",
"assert": "^2.0.0",
"husky": "^4.2.5",
"lint-staged": "^15.0.1",
"mocha": "^8.0.1",
"mocha": "^10.8.2",
"prettier": "^3.0.0",
"reify": "^0.20.12",
"rollup": "^4.3.0",
"ts-node": "^9.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.2.2"
},
"files": [
Expand Down
8 changes: 4 additions & 4 deletions test/auth.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as assert from "assert";
import { strictEqual } from "assert";

import { Auth } from "../dist/auth";
import { Auth } from "../dist/auth.js";

describe("Auth", () => {
it("should indicate correctly when token expired", () => {
Expand All @@ -12,7 +12,7 @@ describe("Auth", () => {
expires_in: 3000,
expires: Date.now() - 1000,
});
assert.strictEqual(auth.expired, true);
strictEqual(auth.expired, true);
});
it("should indicate correctly when token not expired", () => {
const auth = new Auth({
Expand All @@ -23,6 +23,6 @@ describe("Auth", () => {
expires_in: 3000,
expires: Date.now() + 1000,
});
assert.strictEqual(auth.expired, false);
strictEqual(auth.expired, false);
});
});
4 changes: 2 additions & 2 deletions test/config.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from "assert";

import { subscribeConfig } from "../dist/config";
import { MockConnection, AwaitableEvent } from "./util";
import { subscribeConfig } from "../dist/config.js";
import { MockConnection, AwaitableEvent } from "./util.js";

const MOCK_CONFIG = {
hello: "bla",
Expand Down
4 changes: 2 additions & 2 deletions test/entities.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from "assert";

import { subscribeEntities } from "../dist/entities";
import { MockConnection, AwaitableEvent } from "./util";
import { subscribeEntities } from "../dist/entities.js";
import { MockConnection, AwaitableEvent } from "./util.js";

const MOCK_LIGHT = {
entity_id: "light.kitchen",
Expand Down
4 changes: 2 additions & 2 deletions test/services.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from "assert";

import { subscribeServices } from "../dist/services";
import { MockConnection, AwaitableEvent } from "./util";
import { subscribeServices } from "../dist/services.js";
import { MockConnection, AwaitableEvent } from "./util.js";

const MOCK_SERVICES = {
light: {
Expand Down
4 changes: 2 additions & 2 deletions test/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Connection } from "../dist/connection";
import { HaWebSocket } from "../dist/socket";
import { Connection } from "../dist/connection.js";
import { HaWebSocket } from "../dist/socket.js";

class MockWebSocket {
addEventListener(eventType: string, callback: () => {}) {}
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"types": ["mocha"],
"lib": ["es2015", "dom"],
"target": "es2017",
"outDir": "dist",
Expand All @@ -8,7 +9,9 @@
"noImplicitReturns": true,
"noUnusedLocals": true,
"forceConsistentCasingInFileNames": true,
"strict": true
"strict": true,
"module": "ES2015",
"moduleResolution": "Bundler"
},
"include": ["lib/*"]
}
Loading