diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index d118939..54def93 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -13,3 +13,5 @@ jobs: cache: 'npm' - run: npm ci - run: npm run lint + - run: npm run test + - run: npm run build diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..6633786 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,7 @@ +module.exports = { + testEnvironment: 'node', + verbose: true, + collectCoverage: true, + coverageDirectory: 'coverage', + testMatch: ['**/__tests__/**/*.js?(x)', '**/?(*.)+(spec|test).js?(x)'], +}; diff --git a/package.json b/package.json index 7d519ad..39249fc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "semver.md", "scripts": { "lint": "remark -qf semver.md", - "test": "echo \"Error: no test specified\" && exit 1" + "test": "jest", + "build": "tsc" }, "repository": { "type": "git", @@ -28,6 +29,8 @@ "remark-cli": "^11.0.0", "remark-frontmatter": "^2.0.0", "remark-lint-mdash-style": "^1.1.1", - "remark-preset-lint-node": "^1.16.0" + "remark-preset-lint-node": "^1.16.0", + "jest": "^27.0.0", + "typescript": "^4.0.0" } } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..cc8af68 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "ES6", + "module": "commonjs", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true + }, + "include": ["src/**/*"], + "exclude": ["node_modules", "**/*.spec.ts"] +}