Skip to content

Commit 6c3779e

Browse files
committed
Update main.workflow
1 parent e034bc4 commit 6c3779e

File tree

7 files changed

+175
-91
lines changed

7 files changed

+175
-91
lines changed

.github/main.workflow

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
workflow "Build, Lint and Package" {
2+
on = "push"
3+
resolves = ["Package"]
4+
}
5+
6+
action "Build" {
7+
uses = "actions/npm@master"
8+
args = "install"
9+
}
10+
11+
action "Lint" {
12+
needs = "Build"
13+
uses = "actions/npm@master"
14+
args = "run lint"
15+
}
16+
17+
action "Test" {
18+
needs = "Build"
19+
uses = "actions/npm@master"
20+
args = "run test"
21+
}
22+
23+
action "Package" {
24+
needs = "Test"
25+
uses = "actions/npm@master"
26+
args = "run package"
27+
}

.vscode/launch.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
"sourceMaps": true,
1313
"outFiles": ["${workspaceRoot}/out/**/*.js"],
1414
"preLaunchTask": "npm"
15+
},
16+
{
17+
"name": "Extension Tests",
18+
"type": "extensionHost",
19+
"request": "launch",
20+
"runtimeExecutable": "${execPath}",
21+
"args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test"],
22+
"outFiles": ["${workspaceFolder}/out/test/**/*.js"],
23+
"preLaunchTask": "npm"
1524
}
1625
]
1726
}

package-lock.json

Lines changed: 96 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,16 +450,18 @@
450450
}
451451
},
452452
"scripts": {
453-
"vscode:prepublish": "tsc -p ./",
453+
"vscode:prepublish": "npm run compile",
454454
"package": "vsce package",
455455
"compile": "tsc -p ./",
456456
"watch": "tsc -w -p ./tsconfig.json",
457-
"lint": "tslint --project tsconfig.json -t verbose",
457+
"test": "npm run compile && node ./node_modules/vscode/bin/test",
458+
"lint": "node ./node_modules/tslint/bin/tslint --project tsconfig.json -t verbose",
458459
"lint-fix": "tslint --project tsconfig.json -t verbose --fix",
459460
"postinstall": "node ./node_modules/vscode/bin/install"
460461
},
461462
"devDependencies": {
462463
"@types/glob": "^7.1.1",
464+
"@types/mocha": "^5.2.5",
463465
"@types/node": "^10.12.15",
464466
"eslint": "^5.10.0",
465467
"tape": "^4.9.1",

test/extension.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import * as assert from 'assert';
2+
3+
// You can import and use all API from the 'vscode' module
4+
// as well as import your extension to test it
5+
// import * as vscode from 'vscode';
6+
// import * as myExtension from '../extension';
7+
8+
// Defines a Mocha test suite to group tests of similar kind together
9+
suite('Extension Tests', function() {
10+
// Defines a Mocha unit test
11+
test('Something 1', function() {
12+
assert.equal(-1, [1, 2, 3].indexOf(5));
13+
assert.equal(-1, [1, 2, 3].indexOf(0));
14+
});
15+
});

test/index.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING
3+
//
4+
// This file is providing the test runner to use when running extension tests.
5+
// By default the test runner in use is Mocha based.
6+
//
7+
// You can provide your own test runner if you want to override it by exporting
8+
// a function run(testRoot: string, clb: (error:Error) => void) that the extension
9+
// host can call to run the tests. The test runner is expected to use console.log
10+
// to report the results back to the caller. When the tests are finished, return
11+
// a possible error to the callback or null if none.
12+
13+
import * as testRunner from 'vscode/lib/testrunner';
14+
15+
// You can directly control Mocha options by configuring the test runner below
16+
// See https://github.com/mochajs/mocha/wiki/Using-mocha-programmatically#set-options
17+
// for more info
18+
testRunner.configure({
19+
ui: 'tdd', // the TDD UI is being used in extension.test.ts (suite, test, etc.)
20+
useColors: true // colored output from test results
21+
});
22+
23+
module.exports = testRunner;

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
"sourceMap": true,
99
"rootDir": "."
1010
},
11-
"exclude": ["node_modules", ".vscode-test", "test"]
11+
"exclude": ["node_modules", ".vscode-test"]
1212
}

0 commit comments

Comments
 (0)