Skip to content

Add tests and integrate Travis CI #190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 9, 2018
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
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: node_js

node_js:
- "8.0"

script:
- npm run build
- npm test
- npm run tslint
77 changes: 19 additions & 58 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"version": "0.1.0",
"configurations": [
{
"name": "launch as server",
"name": "Launch as server",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/out/debug-adapter/nativeScriptDebug.js",
"runtimeArgs": ["--nolazy"],
"runtimeArgs": ["--nolazy"],
"args": [ "--server=4712" ],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceFolder}/out/**/*.js" ],
"cwd": "${workspaceFolder}"
},
{
"name": "launch in extension host",
"name": "Launch in extension host",
"type": "extensionHost",
"request": "launch",
// Path to VSCode executablensDebugClient
Expand All @@ -24,61 +24,22 @@
],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": [ "${workspaceFolder}/out/**/*.js" ],
"outFiles": [ "${workspaceFolder}/out/**/*.js" ]
},
{
"name": "run tests on mac",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"runtimeArgs": [ "--nolazy" ],
"args": [
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
"--config", "${workspaceRoot}/src/tests/config/mac.json",
"${workspaceRoot}/out/tests/"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out",
"cwd": "${workspaceRoot}"
},
{
"name": "run tests on win",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"runtimeArgs": [ "--nolazy" ],
"args": [
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
"--config", "${workspaceRoot}/src/tests/config/win.json",
"${workspaceRoot}/out/tests/"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out",
"cwd": "${workspaceRoot}"
},
{
"name": "run tests (custom)",
"type": "node",
"request": "launch",
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"runtimeArgs": [ "--nolazy" ],
"args": [
"--opts", "${workspaceRoot}/src/tests/config/mocha.opts",
"--config", "${workspaceRoot}/src/tests/config/custom.json",
"${workspaceRoot}/out/tests/"
],
"stopOnEntry": false,
"sourceMaps": true,
"outDir": "${workspaceRoot}/out",
"cwd": "${workspaceRoot}"
}
{
"name": "Run tests",
"type": "node",
"request": "launch",
"runtimeExecutable": "npm",
"runtimeArgs": [
"run", "test", "--"
]
}
],
"compounds": [
{
"name": "Extension + Server",
"configurations": [ "launch in extension host", "launch as server" ]
}
]
"compounds": [
{
"name": "Extension + Server",
"configurations": [ "Launch in extension host", "Launch as server" ]
}
]
}
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
},
"devDependencies": {
"@types/lodash": "^4.14.109",
"@types/mocha": "2.2.41",
"@types/mocha": "^5.2.1",
"@types/node": "6.0.46",
"mocha": "2.5.3",
"mocha": "^5.2.0",
"sinon": "^5.0.10",
"tslint": "5.10.0",
"tslint-eslint-rules": "^5.3.1",
"typescript": "2.6.2",
"vsce": "~1.36.0",
"vscode": "~1.1.10",
"vscode-debugadapter-testsupport": "1.26.0",
"vscode-debugprotocol": "^1.28.0-pre.1"
},
"scripts": {
Expand All @@ -52,9 +52,7 @@
"package": "vsce package",
"full-build": "npm run clean && npm install && npm run build && npm run package",
"launch-as-server": "node --nolazy ./out/debug-adapter/nativeScriptDebug.js --server=4712",
"test-mac": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/mac.json ./out/tests",
"test-win": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/win.json ./out/tests",
"test-custom": "mocha --opts ./src/tests/config/mocha.opts --config ../../src/tests/config/custom.json ./out/tests",
"test": "mocha --opts ./src/tests/config/mocha.opts",
"tslint": "tslint -p ./src/tsconfig.json -c tslint.json"
},
"main": "./out/main",
Expand Down
7 changes: 5 additions & 2 deletions src/debug-adapter/nativeScriptDebug.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import * as os from 'os';
import * as path from 'path';
import { chromeConnection, ChromeDebugSession } from 'vscode-chrome-debug-core';
import { NativeScriptDebugAdapter } from './nativeScriptDebugAdapter';
import { AndroidProject } from '../project/androidProject';
import { IosProject } from '../project/iosProject';
import { NativeScriptCli } from '../project/nativeScriptCli';
import { nativeScriptDebugAdapterGenerator } from './nativeScriptDebugAdapter';
import { NativeScriptPathTransformer } from './nativeScriptPathTransformer';
import { NativeScriptTargetDiscovery } from './nativeScriptTargetDiscovery';

Expand All @@ -13,7 +16,7 @@ class NSAndroidConnection extends chromeConnection.ChromeConnection {

ChromeDebugSession.run(ChromeDebugSession.getSession(
{
adapter: NativeScriptDebugAdapter,
adapter: nativeScriptDebugAdapterGenerator(IosProject, AndroidProject, NativeScriptCli),
chromeConnection: NSAndroidConnection,
extensionName: 'nativescript-extension',
logFilePath: path.join(os.tmpdir(), 'nativescript-extension.txt'),
Expand Down
Loading