Skip to content

Commit 1ca0658

Browse files
committed
feat: compile test
1 parent 6db8b67 commit 1ca0658

File tree

9 files changed

+22
-81
lines changed

9 files changed

+22
-81
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
yarn run compile-web
2525
- name: Test
2626
run: |
27+
yarn run compile-tests
2728
xvfb-run -a yarn run test
2829
xvfb-run -a yarn run test-web
2930
- name: Publish

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
test.temp
22
.DS_Store
33

4-
/out
4+
out
55
out-view
66
dist
77
node_modules

.vscodeignore

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
packages
1+
.vscode
2+
out/
3+
src/
4+
tsconfig.json
5+
webpack.config.js
6+
esbuild.js
27
yarn.lock
3-
4-
.vscode/**
58
.vscode-test/**
6-
out/test/**
79
views/**
810
test.temp/**
9-
10-
src/**
1111
.gitignore
1212
.yarnrc
1313
vsc-extension-quickstart.md
14-
**/tsconfig.json
1514
**/.eslintrc.json
1615
**/*.map
1716
**/*.ts

esbuild-test.js

Lines changed: 0 additions & 56 deletions
This file was deleted.

esbuild.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async function main() {
1212
sourcemap: !production,
1313
sourcesContent: false,
1414
platform: "node",
15-
outfile: "out/extension.js",
15+
outfile: "dist/extension.js",
1616
external: ["vscode", "jsonc-parser"],
1717
logLevel: "silent",
1818
plugins: [

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"editor-view:watch": "webpack --config ./views/code-snippets-editor/webpack.config.js --watch",
3838
"eslint-fix": "eslint --fix .",
3939
"prettier-fix": "prettier --write .",
40-
"test": "node esbuild-test.js && node ./test/runTest.js",
40+
"compile-tests": "tsc -p . --outDir out",
41+
"test": "node ./out/test/runTest.js",
4142
"test-web": "node ./test/runTestWeb.js",
4243
"watch": "concurrently \"yarn run editor-view:watch\" \"node esbuild.js --watch\"",
4344
"watch-web": "webpack --watch",

test/runTest.js renamed to src/test/runTest.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
1-
const path = require("path");
2-
const { runTests } = require("@vscode/test-electron");
1+
import * as path from "path";
2+
3+
import { runTests } from "@vscode/test-electron";
34

45
async function main() {
56
try {
67
// The folder containing the Extension Manifest package.json
78
// Passed to `--extensionDevelopmentPath`
8-
const extensionDevelopmentPath = path.resolve(__dirname, "../");
9+
const extensionDevelopmentPath = path.resolve(__dirname, "../../");
910

1011
// The path to test runner
1112
// Passed to --extensionTestsPath
12-
const extensionTestsPath = path.resolve(
13-
__dirname,
14-
"../out/test/suite/index",
15-
);
13+
const extensionTestsPath = path.resolve(__dirname, "./suite/index");
1614

1715
// Download VS Code, unzip it and run the integration test
1816
await runTests({
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
const path = require("path");
2-
const { runTests } = require("@vscode/test-web");
1+
import * as path from "path";
2+
import { runTests } from "@vscode/test-web";
33

44
async function main() {
55
try {
66
// The folder containing the Extension Manifest package.json
77
// Passed to `--extensionDevelopmentPath`
8-
const extensionDevelopmentPath = path.resolve(__dirname, "../");
8+
const extensionDevelopmentPath = path.resolve(__dirname, "../../");
99

1010
// The path to test runner
1111
// Passed to --extensionTestsPath
1212
const extensionTestsPath = path.resolve(
1313
__dirname,
14-
"../dist/web/test/suite/index",
14+
"../../dist/web/test/suite/index",
1515
);
1616

1717
// Download VS Code, unzip it and run the integration test

src/test/suite/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import * as path from "path";
2+
import * as Mocha from "mocha";
23
import * as glob from "glob";
34

4-
// eslint-disable-next-line @typescript-eslint/no-require-imports
5-
const Mocha = require("mocha");
6-
75
export function run(): Promise<void> {
86
// Create the mocha test
97
const mocha = new Mocha({
@@ -25,7 +23,7 @@ export function run(): Promise<void> {
2523

2624
try {
2725
// Run the mocha test
28-
mocha.run((failures: any) => {
26+
mocha.run((failures) => {
2927
if (failures > 0) {
3028
e(new Error(`${failures} tests failed.`));
3129
} else {

0 commit comments

Comments
 (0)