Skip to content
Open

wf #2

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
23 changes: 23 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: test
on:
pull_request:
branches:
- main
jobs:
test:
runs-on: windows-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 20
- name: install deps
run: npm install
- name: build
run: npm run build
- name: test/err
run: npm run test-errors
- name: test/err
run: npm run test-preview
187 changes: 186 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
},
"scripts": {
"build": "node-gyp rebuild && node dist.js",
"test-errors": "ts-node --project test/tsconfig.json test/errors.ts",
"test-preview": "ts-node --project test/tsconfig.json test/preview.ts",
"configure-cursor-anysphere": "node-gyp configure -- -f compile_commands_json && copy build\\Release\\compile_commands.json src\\compile_commands.json"
},
"files": [
Expand All @@ -24,7 +26,8 @@
"license": "LGPL-2.0",
"devDependencies": {
"@types/node": "^24.1.0",
"node-gyp": "^11.2.0"
"node-gyp": "^11.2.0",
"ts-node": "^10.9.2"
},
"dependencies": {
"node-addon-api": "^8.4.0"
Expand Down
4 changes: 2 additions & 2 deletions test/errors.js → test/errors.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const noobs = require('../index.js');
import noobs from '../index.js';
const assert = require('assert');

async function test() {
let errMsg = '';
try {
noobs.GetSourceSettings('Test Source');
} catch (e) {
} catch (e: any) {
errMsg = e.message;
}
assert.equal(errMsg, 'Obs not initialized');
Expand Down
4 changes: 2 additions & 2 deletions test/preview.js → test/preview.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const noobs = require('../index.js');
import noobs from '../index.js';
const path = require('path');

async function test() {
Expand All @@ -13,13 +13,13 @@
console.log('Log path:', logPath);
console.log('Recording path:', recordingPath);

noobs.Init(distPath, logPath, recordingPath, cb);

Check failure on line 16 in test/preview.ts

View workflow job for this annotation

GitHub Actions / test

Expected 3 arguments, but got 4.

// TODO - work out how to get a HWND to actually launch this. Maybe need some CPP code.
// noobs.InitPreview(null); // Pass null for now, as we don't have a HWND yet.
// noobs.ShowPreview(0, 0, 800, 600); // Show the preview at 800x600.
const s = noobs.GetPreviewInfo();
console.log("info:", s);
console.log('info:', s);

noobs.Shutdown();
console.log('Test Done');
Expand Down
10 changes: 10 additions & 0 deletions test/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"compilerOptions": {
"esModuleInterop": true,
"noImplicitAny": true,
"noEmit": true,
"strict": true,
},
"include": ["*.ts", "../index.d.ts"]
}

Loading