Skip to content

Commit

Permalink
chore: lint and add test script
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienKode committed Oct 31, 2020
1 parent a5477b6 commit ef002d7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "build"
on:
pull_request:
push:

jobs:
build: # make sure build/ci work properly
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"format-check": "prettier --check **/*.ts",
"lint": "eslint src/**/*.ts",
"pack": "ncc build",
"test": "jest",
"build:pack": "npm run build && npm run pack",
"all": "npm run build && npm run format && npm run lint && npm run pack"
"all": "npm run build && npm run test && npm run format && npm run lint && npm run pack"
},
"repository": {
"type": "git",
Expand Down
15 changes: 9 additions & 6 deletions test/linter.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import {lintPullRequest} from '../src/linter'


test('should lint the title correctly', async () => {
// Given
const title = "feat(valid): scope"
const title = 'feat(valid): scope'

// Expect
await expect(lintPullRequest(title, './commitlint.config.js')).resolves.toBeUndefined()
await expect(
lintPullRequest(title, './commitlint.config.js')
).resolves.toBeUndefined()
})

test('should raise errors', async () => {
// Given
const title = "feat(INVALID): scope"
const title = 'feat(INVALID): scope'

// Expect
await expect(lintPullRequest(title, './commitlint.config.js')).rejects.toThrow()
})
await expect(
lintPullRequest(title, './commitlint.config.js')
).rejects.toThrow()
})

0 comments on commit ef002d7

Please sign in to comment.