Skip to content
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

tweak vscode and mocha tooling somewhat #2133

Merged
merged 2 commits into from
Dec 31, 2022
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: 5 additions & 4 deletions .config/mocha.fast.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"$schema": "https://json.schemastore.org/mocharc.json",
"timeout": 5000,
"spec": ["src/test/**/*.test.ts"],
"exclude": ["src/test/packages/**", "src/test/slow/**"],
"watch-files": ["src/**/*.ts"],
"extension": ["ts", "tsx"]
"extension": ["ts", "tsx"],
"require": ["ts-node/register"],
"spec": ["src/test/**/*.test.ts"],
"timeout": 5000,
"watch-files": ["src/**/*.ts"]
}
4 changes: 3 additions & 1 deletion .config/mocha.full.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"$schema": "https://json.schemastore.org/mocharc.json",
"timeout": 0,
"spec": "src/test/**/*.test.ts",
"exclude": ["src/test/packages/**"]
"exclude": ["src/test/packages/**"],
"require": ["ts-node/register"]
}
3 changes: 2 additions & 1 deletion .config/mocha.test-explorer.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"$schema": "https://json.schemastore.org/mocharc.json",
"extension": ["ts"],
"ignore": ["src/test/slow/**", "src/test/packages/**"],
"package": "./package.json",
"require": "ts-node/register",
"slow": 500,
"spec": ["src/**/*.test.ts"],
"ignore": ["src/test/slow/**", "src/test/packages/**"],
"timeout": 0,
"watch-files": ["src/**/*.ts"]
}
77 changes: 71 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,81 @@
"version": "2.0.0",
"tasks": [
{
"label": "build",
"label": "build-tsc",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, guess you can tell how often I actually use these... I always just have yarn build:tsc running in a terminal.

"type": "npm",
"script": "build:tsc",
"problemMatcher": ["$tsc"],
"detail": "Build TypeDoc w/ tsc",
"presentation": {
"group": "build",
"panel": "dedicated"
},
"group": {
"kind": "build"
}
},
{
"label": "build-themes",
"type": "npm",
"script": "build:themes",
"problemMatcher": ["$esbuild"],
"detail": "Build TypeDoc themes",
"presentation": {
"group": "build",
"panel": "dedicated"
},
"group": {
"kind": "build"
}
},
{
"label": "dev-build-tsc",
"type": "shell",
"command": "npm run build",
"problemMatcher": ["$tsc"]
"command": "npm run build:tsc -- --watch",
"problemMatcher": ["$tsc-watch"],
"detail": "Build TypeDoc w/ tsc in watch mode",
"isBackground": true,
"presentation": {
"group": "dev",
"panel": "dedicated"
},
"group": {
"kind": "build"
}
},
{
"label": "build_and_test",
"label": "dev-build-themes",
"type": "shell",
"command": "npm run build_and_test",
"problemMatcher": ["$tsc"]
"command": "npm run build:themes -- --watch",
"problemMatcher": ["$esbuild-watch"],
"detail": "Build TypeDoc themes in watch mode",
"isBackground": true,
"presentation": {
"group": "dev",
"panel": "dedicated"
},
"group": {
"kind": "build"
}
},
{
"label": "dev",
"dependsOn": ["dev-build-tsc", "dev-build-themes"],
"detail": "Build TypeDoc in watch mode",
"problemMatcher": [],
"group": {
"kind": "build"
}
},
{
"label": "build",
"dependsOn": ["build-tsc", "build-themes"],
"detail": "Build TypeDoc",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@
"/tsdoc.json"
],
"scripts": {
"test": "mocha -r ts-node/register --config .config/mocha.fast.json",
"test:cov": "c8 mocha -r ts-node/register --config .config/mocha.fast.json",
"test": "mocha --config .config/mocha.fast.json",
"test:cov": "c8 mocha --config .config/mocha.fast.json",
"doc:c": "node bin/typedoc --tsconfig src/test/converter/tsconfig.json",
"doc:c2": "node bin/typedoc --tsconfig src/test/converter2/tsconfig.json",
"test:full": "c8 mocha -r ts-node/register --config .config/mocha.full.json",
"test:full": "c8 mocha --config .config/mocha.full.json",
"test:visual": "ts-node ./src/test/capture-screenshots.ts && ./scripts/compare_screenshots.sh",
"test:visual:accept": "node scripts/accept_visual_regression.js",
"rebuild_specs": "node scripts/rebuild_specs.js",
Expand Down
26 changes: 16 additions & 10 deletions scripts/build_themes.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
const esbuild = require("esbuild");

esbuild.buildSync({
entryPoints: ["src/lib/output/themes/default/assets/bootstrap.ts"],
bundle: true,
minify: true,
outfile: "static/main.js",
banner: {
js: '"use strict";',
},
logLevel: "info",
});
esbuild
.build({
entryPoints: ["src/lib/output/themes/default/assets/bootstrap.ts"],
bundle: true,
minify: true,
outfile: "static/main.js",
banner: {
js: '"use strict";',
},
logLevel: "info",
watch: process.argv.slice(2).includes("--watch"),
})
.catch((err) => {
console.error(err);
process.exitCode = 1;
});