generated from xddq/nodejs-typescript-modern-starter
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: cleanup, update readme, use jest and npm scripts (#49)
## Summary Just cleaning up a little. - use jest instead of nodejs test runner - remove tasks.mjs file and just use npm scripts - slightly move test files - update readme
- Loading branch information
Showing
18 changed files
with
3,489 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -141,4 +141,4 @@ TODO | |
.yarn | ||
generated-typebox.ts | ||
examples | ||
test/integration/schemas/*.ts | ||
test/fixture/*.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ jobs: | |
- name: Install Dependencies | ||
run: yarn --immutable | ||
- name: Lint | ||
run: yarn lint-check | ||
run: yarn lint:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,4 +139,5 @@ node_modules | |
TODO* | ||
/schema.json | ||
generated-typebox.ts | ||
.envrc | ||
!examples/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
presets: [ | ||
["@babel/preset-env", { targets: { node: "current" } }], | ||
"@babel/preset-typescript", | ||
], | ||
// required for easily mocking module exports. | ||
// see: https://stackoverflow.com/questions/67872622/jest-spyon-not-working-on-index-file-cannot-redefine-property | ||
assumptions: { | ||
constantReexports: true, | ||
}, | ||
plugins: [], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//@ts-check | ||
/** | ||
* For a detailed explanation regarding each configuration property, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
/** @type {import('jest').Config} */ | ||
const config = { | ||
// Automatically clear mock calls, instances, contexts and results before every test | ||
clearMocks: true, | ||
// Indicates whether the coverage information should be collected while executing the test | ||
collectCoverage: true, | ||
coverageReporters: ["lcov", "text"], | ||
collectCoverageFrom: [ | ||
"src/*.ts", | ||
"!**/node_modules/**", | ||
"!**/dist/**", | ||
"!**/*.(spec|test|d).ts", | ||
], | ||
// The directory where Jest should output its coverage files | ||
coverageDirectory: "coverage", | ||
// Indicates which provider should be used to instrument code for coverage | ||
coverageProvider: "v8", | ||
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped | ||
testPathIgnorePatterns: ["/node_modules/", "/dist/"], | ||
// Indicates whether each individual test should be reported during the run | ||
verbose: true, | ||
testMatch: [ | ||
"**/test/**/*.[jt]s?(x)", | ||
"!**/test/util/**/*.[jt]s?(x)", | ||
"!**/test/fixture/**/*.[jt]s?(x)", | ||
"**/?(*.)+(spec|test).[tj]s?(x)", | ||
], | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,20 +12,16 @@ | |
"author": "Pierre Dahmani <[email protected]>", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "node tasks.mjs build", | ||
"bundle": "node tasks.mjs bundle", | ||
"clean": "node tasks.mjs clean", | ||
"dev": "concurrently \"npm:watch-*\"", | ||
"format": "node tasks.mjs format --write", | ||
"format-check": "node tasks.mjs format --check", | ||
"gen-dummy": "node dist/src/generate-dummy-schema.js", | ||
"lint": "node tasks.mjs lint --fix", | ||
"lint-check": "node tasks.mjs lint", | ||
"start": "node tasks.mjs start", | ||
"test": "node tasks.mjs test", | ||
"watch-node": "node tasks.mjs watch-node", | ||
"watch-ts": "node tasks.mjs watch-ts", | ||
"release": "yarn build && npm publish" | ||
"compile": "tsc", | ||
"compile:watch": "tsc -w", | ||
"dev": "nodemon --watch src --watch test --ext ts,json --exec 'yarn compile && yarn start'", | ||
"format": "prettier . --write", | ||
"format:check": "prettier . --check", | ||
"lint": "eslint . --fix", | ||
"lint:check": "eslint .", | ||
"start": "node --enable-source-maps ./dist/src/index.js", | ||
"test": "jest --runInBand .", | ||
"release": "rm -r dist && yarn compile && npm publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
|
@@ -57,20 +53,23 @@ | |
"typescript": "5.0.4" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.24.5", | ||
"@babel/preset-env": "7.24.5", | ||
"@babel/preset-typescript": "7.24.1", | ||
"@jest/globals": "29.7.0", | ||
"@tsconfig/node18": "2.0.0", | ||
"@types/chai": "4.3.5", | ||
"@types/jest": "29.5.12", | ||
"@types/minimist": "1.2.2", | ||
"@types/node": "18.16.8", | ||
"@types/nodemon": "1.19.2", | ||
"@types/prettier": "2.7.2", | ||
"@types/shelljs": "0.8.12", | ||
"@typescript-eslint/eslint-plugin": "5.59.6", | ||
"@typescript-eslint/parser": "5.59.6", | ||
"chai": "4.3.7", | ||
"concurrently": "7.6.0", | ||
"esbuild": "0.17.18", | ||
"eslint": "8.40.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"jest": "29.7.0", | ||
"nodemon": "2.0.22", | ||
"shelljs": "0.8.5" | ||
}, | ||
|
Oops, something went wrong.