diff --git a/.travis.yml b/.travis.yml index f36c29b8b..837dcf670 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,4 +54,5 @@ install: script: - npm run lint + - npm run unit-test - npm test --silent diff --git a/.vscode/launch.json b/.vscode/launch.json index aae83cbde..6f19937f1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -25,7 +25,7 @@ "preLaunchTask": "npm" }, { - "name": "Launch Tests", + "name": "Launch Integration Tests", "type": "extensionHost", "request": "launch", "runtimeExecutable": "${execPath}", @@ -42,7 +42,7 @@ { "type": "node", "request": "launch", - "name": "Unit Tests", + "name": "Launch Unit Tests", "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", "args": [ "-u", diff --git a/package.json b/package.json index 2b74ea649..b850fe5b4 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "compile": "tsc -watch -p ./", "postinstall": "node ./node_modules/vscode/bin/install", "test": "node ./node_modules/vscode/bin/test", - "lint": "node ./node_modules/tslint/bin/tslint ./src/*.ts ./src/debugAdapter/*.ts ./test/*.ts" + "lint": "node ./node_modules/tslint/bin/tslint ./src/*.ts ./src/debugAdapter/*.ts ./test/*.ts", + "unit-test": "node ./node_modules/mocha/bin/_mocha -u tdd --timeout 5000 --colors ./out/test/unit" }, "extensionDependencies": [], "dependencies": { @@ -1367,4 +1368,4 @@ ] } } -} \ No newline at end of file +} diff --git a/test/unit/utils.test.ts b/test/utils.test.ts similarity index 55% rename from test/unit/utils.test.ts rename to test/utils.test.ts index b1c23b507..ea2f53798 100644 --- a/test/unit/utils.test.ts +++ b/test/utils.test.ts @@ -3,21 +3,21 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------*/ -import { guessPackageNameFromFile } from "../../src/util"; -import * as assert from "assert"; -import { substituteEnv } from "../../src/util"; +import { guessPackageNameFromFile } from '../src/util'; +import * as assert from 'assert'; +import { substituteEnv } from '../src/util'; -suite("utils Tests", () => { - test("substituteEnv: default", () => { +suite('utils Tests', () => { + test('substituteEnv: default', () => { // prepare test const env = Object.assign({}, process.env); - process.env["test1"] = "abcd"; - process.env["test2"] = "defg"; + process.env['test1'] = 'abcd'; + process.env['test2'] = 'defg'; let actual = substituteEnv( - " ${env:test1} \r\n ${env:test2}\r\n${env:test1}" + ' ${env:test1} \r\n ${env:test2}\r\n${env:test1}' ); - let expected = " abcd \r\n defg\r\nabcd"; + let expected = ' abcd \r\n defg\r\nabcd'; assert.equal(actual, expected); @@ -26,10 +26,10 @@ suite("utils Tests", () => { }); }); -suite("GuessPackageNameFromFile Tests", () => { - test("package name from main file", done => { - const expectedPackageName = "main"; - const filename = "main.go"; +suite('GuessPackageNameFromFile Tests', () => { + test('package name from main file', done => { + const expectedPackageName = 'main'; + const filename = 'main.go'; guessPackageNameFromFile(filename) .then(result => { @@ -38,9 +38,9 @@ suite("GuessPackageNameFromFile Tests", () => { .then(() => done(), done); }); - test("package name from dirpath", done => { - const expectedPackageName = "package"; - const fileDir = "path/package/file.go"; + test('package name from dirpath', done => { + const expectedPackageName = 'package'; + const fileDir = 'path/package/file.go'; guessPackageNameFromFile(fileDir) .then(([result]) => { @@ -49,10 +49,10 @@ suite("GuessPackageNameFromFile Tests", () => { .then(() => done(), done); }); - test("package name from test file", done => { - const expectedPackageName = "file"; - const expectedPackageTestName = "file_test"; - const fileDir = "file_test.go"; + test('package name from test file', done => { + const expectedPackageName = 'file'; + const expectedPackageTestName = 'file_test'; + const fileDir = 'file_test.go'; guessPackageNameFromFile(fileDir) .then(([packageNameResult, packageTestNameResult]) => {