Skip to content

Commit

Permalink
test: setup vscode launch config + mocha integration
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatWizard committed Apr 22, 2024
1 parent 1fddb41 commit e2d1ccc
Show file tree
Hide file tree
Showing 42 changed files with 335 additions and 43 deletions.
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Program",
"program": "${workspaceFolder}/index.js",
"request": "launch",
"skipFiles": ["<node_internals>/**"],
"type": "node"
}
]
}
31 changes: 18 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,22 @@
"lint": "eslint . --cache",
"lint:fix": "eslint . --fix",
"pretest": "node scripts/github-releases.js",
"test": "npm-run-all test:*",
"test:custom-fonts-ttf": "./index.js --debug --epub --mobi --pdf tests/custom-fonts-ttf && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/custom-fonts-ttf/*.epub",
"test:custom-fonts-otf": "./index.js --debug --epub --mobi --pdf tests/custom-fonts-otf && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/custom-fonts-otf/*.epub",
"test:docx-one-file": "./index.js --debug --epub --mobi --pdf tests/docx-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/docx-one-file/*.epub",
"test:latex-one-file": "./index.js --debug --epub --mobi --pdf tests/latex-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/latex-one-file/*.epub",
"test:markdown-one-file": "./index.js --debug --epub --mobi --pdf tests/markdown-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/latex-one-file/*.epub",
"test:odt-one-file": "./index.js --debug --epub --mobi --pdf tests/odt-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/odt-one-file/*.epub ; echo 'This is fine.'",
"test:latex-multi-files": "./index.js --debug --epub --mobi --pdf tests/latex-multi-files && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/latex-multi-files/*.epub",
"test:markdown-multi-files": "./index.js --debug --epub --mobi --pdf tests/markdown-multi-files && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/markdown-multi-files/*.epub",
"test:metadata": "./index.js --debug --epub tests/metadata && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/metadata/*.epub",
"test:minimal": "./index.js --debug --epub tests/minimal && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/minimal/*.epub",
"test:toc": "./index.js --debug --epub --pdf tests/toc && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/toc/*.epub",
"build": "pkg . --out-path=build"
"test": "npm-run-all test:acceptance test:unit",
"test:acceptance": "npm-run-all test:acceptance:*",
"test:acceptance:custom-fonts-ttf": "./index.js --debug --epub --mobi --pdf tests/acceptance/custom-fonts-ttf && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/custom-fonts-ttf/*.epub",
"test:acceptance:custom-fonts-otf": "./index.js --debug --epub --mobi --pdf tests/acceptance/custom-fonts-otf && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/custom-fonts-otf/*.epub",
"test:acceptance:docx-one-file": "./index.js --debug --epub --mobi --pdf tests/acceptance/docx-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/docx-one-file/*.epub",
"test:acceptance:latex-one-file": "./index.js --debug --epub --mobi --pdf tests/acceptance/latex-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/latex-one-file/*.epub",
"test:acceptance:markdown-one-file": "./index.js --debug --epub --mobi --pdf tests/acceptance/markdown-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/latex-one-file/*.epub",
"test:acceptance:odt-one-file": "./index.js --debug --epub --mobi --pdf tests/acceptance/odt-one-file && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/odt-one-file/*.epub ; echo 'This is fine.'",
"test:acceptance:latex-multi-files": "./index.js --debug --epub --mobi --pdf tests/acceptance/latex-multi-files && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/latex-multi-files/*.epub",
"test:acceptance:markdown-multi-files": "./index.js --debug --epub --mobi --pdf tests/acceptance/markdown-multi-files && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/markdown-multi-files/*.epub",
"test:acceptance:metadata": "./index.js --debug --epub tests/acceptance/metadata && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/metadata/*.epub",
"test:acceptance:minimal": "./index.js --debug --epub tests/acceptance/minimal && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/minimal/*.epub",
"test:acceptance:toc": "./index.js --debug --epub --pdf tests/acceptance/toc && java -jar github_releases/w3c/epubcheck/epubcheck-*/epubcheck.jar tests/acceptance/toc/*.epub",
"build": "pkg . --out-path=build",
"test:unit": "mocha tests/unit/**/*.mjs",
"start": "node index.js"
},
"dependencies": {
"archiver": "^5.3.0",
Expand All @@ -77,12 +80,14 @@
"unzipper": "^0.10.10"
},
"devDependencies": {
"chai": "^5.1.0",
"download-github-release": "^0.3.2",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"mocha": "^10.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.5.1"
},
Expand Down
2 changes: 1 addition & 1 deletion tests/.gitignore → tests/acceptance/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
*.synctex.gz
*.fdb_latexmk
*.fls
kindlegen*
kindlegen*
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions tests/unit/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}
7 changes: 7 additions & 0 deletions tests/unit/index.tests.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { expect } from 'chai'

describe('index', function () {
it('works', function () {
expect([1, 2, 3].indexOf(4)).to.equal(-1)
})
})
Loading

0 comments on commit e2d1ccc

Please sign in to comment.