Skip to content

Commit c395895

Browse files
prsdamascenoeddyStreamlabs
authored and
eddyStreamlabs
committedMar 27, 2019
Make osn-tests easier to run locally and in appveyor (#328)
* Make osn-tests easier to run locally and on appveyor * Add missing tsconfig.json file * Remove local path from index.ts * Add Debug flag to local build script * Removed clean script because git clean can prevent some node_module folders from being removed * Remove index.ts This file is generated by CMake, there is no need to track it in the repository
1 parent c1bfe1a commit c395895

24 files changed

+650
-334
lines changed
 

‎CMakeLists.txt

+6
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ if(WIN32)
5252
${PROJECT_SOURCE_DIR}/tests/helpers/obs.js
5353
@ONLY
5454
)
55+
56+
configure_file(
57+
${PROJECT_SOURCE_DIR}/cmake/index.ts.in
58+
${PROJECT_SOURCE_DIR}/tests/osn-tests/osn/index.ts
59+
@ONLY
60+
)
5561
endif()
5662

5763
add_subdirectory(lib-streamlabs-ipc)

‎appveyor.yml

+1-6
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,8 @@ after_build:
4242
- copy "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\ucrtbase.dll" "%SLFullDistributePath%\obs-studio-node\"
4343
- tar cvaf "%UnsignedArtifact%.tar.gz" -C "%SLFullDistributePath%" "obs-studio-node"
4444

45-
before_test:
46-
- cmd: cd tests\osn-tests
47-
- cmd: yarn install
48-
4945
test_script:
5046
- cmd: yarn run test
51-
- cmd: cd ..\..
5247

5348
before_deploy:
5449
- cmd: ci\copy-signed-binaries.cmd
@@ -79,4 +74,4 @@ artifacts:
7974
- path: $(UnsignedArtifact).tar.gz
8075
name: Unsigned Aritfact
8176

82-
test: on
77+
test: on

‎cmake/index.ts.in

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export * from '@CMAKE_INSTALL_PREFIX@/index';
2+
3+
const wd: string = "@CMAKE_INSTALL_PREFIX@";
4+
export {wd};

‎package.json

+15-3
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,29 @@
1515
"main": "./index.js",
1616
"types": "./index.d.ts",
1717
"scripts": {
18-
"clean": "git clean -fxd",
1918
"build:bindings": "cmake-js configure -a x64 --CDCMAKE_PREFIX_INSTALL=distribute && cmake --build build --target install --config Release",
2019
"build:javascript": "tsc -p js",
21-
"build:docs": "typedoc --out docs"
20+
"build:docs": "typedoc --out docs",
21+
"local:config": "yarn install && git submodule update --init --recursive --force && cmake -Bbuild -H. -G\"Visual Studio 15 2017\" -A x64 -DCMAKE_INSTALL_PREFIX=\"./obs-studio-node\"",
22+
"local:build": "cmake --build build --target install --config Debug",
23+
"local:clean": "rm -rf build/*",
24+
"test": "mocha --no-timeouts -r ts-node/register tests/osn-tests/src/**/*.ts"
2225
},
2326
"devDependencies": {
27+
"@types/chai": "^4.1.7",
28+
"@types/mocha": "^5.2.5",
29+
"@types/node": "^11.9.5",
30+
"chai": "^4.2.0",
31+
"mocha": "^5.2.0",
2432
"nan": "2.10.0",
33+
"request": "^2.88.0",
34+
"rxjs": "^6.4.0",
35+
"ts-node": "^7.0.1",
2536
"typedoc": "^0.11.1",
2637
"typedoc-default-themes": "^0.5.0",
2738
"typedoc-plugin-markdown": "^1.0.12",
28-
"typescript": "^2.9.2"
39+
"typescript": "^2.9.2",
40+
"uuid": "^3.0.1"
2941
},
3042
"keywords": [
3143
"capture",

‎tests/osn-tests/osn/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/index.ts

‎tests/osn-tests/src/test_nodeobs_api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import { OBSProcessHandler } from '../util/obs_process_handler';
55
import { basicOBSInputTypes, showHideInputHotkeys, slideshowHotkeys, ffmpeg_sourceHotkeys, game_captureHotkeys, dshow_wasapitHotkeys } from '../util/general';
66

‎tests/osn-tests/src/test_nodeobs_autoconfig.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'mocha';
2-
import * as osn from 'obs-studio-node';
2+
import * as osn from '../osn';
33
import { OBSProcessHandler } from '../util/obs_process_handler';
44
import { Services } from '../util/services';
55
import { deleteConfigFiles } from '../util/general';
@@ -166,4 +166,4 @@ describe('nodeobs_autoconfig', () => {
166166
});
167167
});
168168
});
169-
});
169+
});

‎tests/osn-tests/src/test_nodeobs_service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import { OBSProcessHandler } from '../util/obs_process_handler';
55
import { Subject } from 'rxjs';
66
import { Services } from '../util/services';
@@ -416,4 +416,4 @@ describe('nodeobs_service', function() {
416416
}).to.not.throw();
417417
})
418418
});
419-
});
419+
});

‎tests/osn-tests/src/test_nodeobs_settings.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import { OBSProcessHandler } from '../util/obs_process_handler';
55
import { deleteConfigFiles, basicOBSSettingsCategories } from '../util/general';
66

@@ -2662,4 +2662,4 @@ describe('nodeobs_settings', function() {
26622662
expect(categories).to.include.members(basicOBSSettingsCategories);
26632663
});
26642664
});
2665-
});
2665+
});

‎tests/osn-tests/src/test_osn_fader.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha'
22
import { expect } from 'chai'
33
import { OBSProcessHandler } from '../util/obs_process_handler'
4-
import * as osn from 'obs-studio-node';
4+
import * as osn from '../osn';
55

66
describe('osn_fader', () => {
77
let obs: OBSProcessHandler;
@@ -127,4 +127,4 @@ describe('osn_fader', () => {
127127
});
128128
});
129129
});
130-
});
130+
});

‎tests/osn-tests/src/test_osn_filter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
4-
import { IFilter, ISettings } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { IFilter, ISettings } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSFilterTypes } from '../util/general';
77

@@ -67,4 +67,4 @@ describe('osn-filter', () => {
6767
});
6868
});
6969
});
70-
});
70+
});

‎tests/osn-tests/src/test_osn_global.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
4-
import { IInput, ISource } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { IInput, ISource } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSInputTypes } from '../util/general';
77

@@ -128,4 +128,4 @@ describe('osn-global', () => {
128128
expect(locale).to.equal('pt-BR');
129129
});
130130
});
131-
});
131+
});

‎tests/osn-tests/src/test_osn_input.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
4-
import { IInput, ISettings, ITimeSpec, IFilter } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { IInput, ISettings, ITimeSpec, IFilter } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSInputTypes, getTimeSpec } from '../util/general';
77

@@ -464,4 +464,4 @@ describe('osn-input', () => {
464464
input.release();
465465
});
466466
});
467-
});
467+
});

‎tests/osn-tests/src/test_osn_module.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import * as path from 'path';
55
import * as fs from 'fs';
66
import { OBSProcessHandler } from '../util/obs_process_handler';

‎tests/osn-tests/src/test_osn_scene.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
4-
import { IScene, ISceneItem, IInput } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { IScene, ISceneItem, IInput } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSInputTypes } from '../util/general';
77

‎tests/osn-tests/src/test_osn_sceneitem.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import { IInput } from 'obs-studio-node';
4-
import * as osn from 'obs-studio-node';
3+
import { IInput } from '../osn';
4+
import * as osn from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66

77
interface IVec2 {
@@ -357,4 +357,4 @@ describe('osn-sceneitem', () => {
357357
sceneItem.remove();
358358
});
359359
});
360-
});
360+
});

‎tests/osn-tests/src/test_osn_source.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
4-
import { ISettings } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { ISettings } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSInputTypes, basicOBSFilterTypes, basicOBSTransitionTypes } from '../util/general';
77

@@ -462,4 +462,4 @@ describe('osn-source', () => {
462462
});
463463
});
464464
});
465-
});
465+
});

‎tests/osn-tests/src/test_osn_transition.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'mocha'
22
import { expect } from 'chai'
3-
import * as osn from 'obs-studio-node';
4-
import { IScene, ITransition, ISettings, ISource } from 'obs-studio-node';
3+
import * as osn from '../osn';
4+
import { IScene, ITransition, ISettings, ISource } from '../osn';
55
import { OBSProcessHandler } from '../util/obs_process_handler';
66
import { basicOBSTransitionTypes } from '../util/general';
77

@@ -134,4 +134,4 @@ describe('osn-transition', () => {
134134
scene.release();
135135
});
136136
});
137-
});
137+
});

‎tests/osn-tests/src/test_osn_video.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import { OBSProcessHandler } from '../util/obs_process_handler';
55

66
describe('osn-video', () => {
@@ -43,4 +43,4 @@ describe('osn-video', () => {
4343
expect(totalFrames).to.equal(0);
4444
});
4545
});
46-
});
46+
});

‎tests/osn-tests/src/test_osn_volmeter.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'mocha';
22
import { expect } from 'chai';
3-
import * as osn from 'obs-studio-node';
3+
import * as osn from '../osn';
44
import { OBSProcessHandler } from '../util/obs_process_handler';
55

66
interface Dictionary<TItemType> {
@@ -98,4 +98,4 @@ describe('osn-volmeter', () => {
9898
input.release();
9999
});
100100
});
101-
});
101+
});

‎tests/osn-tests/util/general.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ITimeSpec } from 'obs-studio-node';
1+
import { ITimeSpec } from '../osn';
22
import { setOptions } from 'marked';
33

44
const basicOBSInputTypes: string[] = ['image_source', 'color_source', 'slideshow', 'browser_source', 'ffmpeg_source', 'text_gdiplus', 'text_ft2_source',

‎tests/osn-tests/util/obs_process_handler.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import * as osn from 'obs-studio-node';
1+
import * as osn from '../osn';
22

33
export class OBSProcessHandler {
44
startup(): osn.EVideoCodes {
55
const path = require('path');
66
const uuid = require('uuid/v4');
77

8-
const wd = path.join(path.normalize(__dirname), '..', 'node_modules', 'obs-studio-node');
8+
const wd = path.normalize(osn.wd);
99
const pipeName = 'osn-tests-pipe'.concat(uuid());
1010

1111
try {
@@ -27,4 +27,4 @@ export class OBSProcessHandler {
2727

2828
return true;
2929
}
30-
}
30+
}

‎tsconfig.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"compilerOptions": {
3+
"outDir": "../out",
4+
"target": "es5",
5+
"module": "commonjs",
6+
"moduleResolution": "node",
7+
"sourceMap": true,
8+
"experimentalDecorators": true,
9+
"lib": [ "es6", "es5" ],
10+
},
11+
"exclude": [
12+
"node_modules"
13+
],
14+
"compileOnSave": false
15+
}

‎yarn.lock

+570-287
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.