Skip to content

Commit

Permalink
Merge pull request #12 from route06/issue-3-enable-test
Browse files Browse the repository at this point in the history
Enable testing by 'jest' on CI
  • Loading branch information
Rindrics authored Jun 13, 2024
2 parents 17d39e5 + a814394 commit 1b72947
Show file tree
Hide file tree
Showing 8 changed files with 5,381 additions and 1,328 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI on pull request

on:
pull_request:
push:
branches:
- main

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install pnpm
run: npm install -g pnpm

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.node-version'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
22.3
13 changes: 13 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
],
"@babel/preset-typescript"
]
}
27 changes: 27 additions & 0 deletions jest.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
var esmModules = [
"chalk",
"ora",
"cli-cursor",
"restore-cursor",
"log-symbols",
"is-unicode-supported",
"strip-ansi",
"ansi-regex",
"is-interactive",
"stdin-discarder",
];

module.exports = {
preset: "ts-jest/presets/js-with-babel",
testEnvironment: "node",
transform: {
"^.+\\.[tj]sx?$": "babel-jest",
},
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
transformIgnorePatterns: [
`node_modules/(?!(?:.pnpm/)?(${esmModules.join('|')}))`,
],
testMatch: ["**/?(*.)+(test).[tj]s?(x)"],
};
10 changes: 9 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"predev": "run-s clean",
"clean": "rm -rf dist",
"typecheck": "tsc --noEmit",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest"
},
"keywords": [
"aws",
Expand Down Expand Up @@ -59,8 +59,16 @@
"ora": "^6.1.2"
},
"devDependencies": {
"@babel/core": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-typescript": "^7.24.6",
"@types/jest": "^29.5.12",
"@types/node": "^18.11.18",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"js-with-babel": "link:ts-jest/presets/js-with-babel",
"npm-run-all": "^4.1.5",
"ts-jest": "^29.1.4",
"ts-node": "^10.9.1",
"tsup": "^6.5.0",
"typescript": "^4.9.4"
Expand Down
Loading

0 comments on commit 1b72947

Please sign in to comment.