Skip to content

Commit

Permalink
initial linting and testing set up
Browse files Browse the repository at this point in the history
  • Loading branch information
jennymar committed Oct 16, 2024
1 parent 9d5a975 commit b1ee221
Show file tree
Hide file tree
Showing 5 changed files with 1,986 additions and 13 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Linting and Testing
on:
pull_request:
branches:
- main
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Run ESLint
run: yarn lint
test:
runs-on: ubuntu-latest
needs: lint
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '18'

- name: Install dependencies
run: yarn install

- name: Run tests
run: yarn test
13 changes: 13 additions & 0 deletions jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"transform": {
"^.+\\.ts$": "ts-jest"
},
"modulePaths": ["<rootDir>/src"],
"testRegex": "tests/.*\\.tests?\\.ts$",
"moduleFileExtensions": [
"ts",
"js",
"json",
"node"
]
}
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,24 @@
"version": "0.1.0",
"description": "REST API for ACM at UCSD's hackathon portal.",
"main": "index.js",
"scripts": {
"build": "tsc",
"test": "jest --config jest.config.json --runInBand",
"lint": "eslint ./ --ext .ts",
"lint:fix": "eslint ./ --ext .ts --fix"
},
"repository": "https://github.com/acmucsd/hackathon-portal.git",
"author": "Eric Chang <[email protected]>",
"dependencies": {},
"devDependencies": {
"@types/jest": "^29.5.13",
"@typescript-eslint/eslint-plugin": "^7.0.0",
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.57.1",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-plugin-import": "^2.31.0",
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
"typescript": "^5.6.3"
}
}
17 changes: 17 additions & 0 deletions tests/sample.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('dummy test', () => {
test('dummy test case always passes', () => {
expect(1 + 1).toBe(2);
});
});

describe('dummy test', () => {
test('another dummy test case always passes', () => {
expect(1 + 2).toBe(3);
});
});

describe('dummy test', () => {
test('dummy test will fail', () => {
expect(1 + 1).toBe(0);
});
});
Loading

0 comments on commit b1ee221

Please sign in to comment.