Skip to content

Commit

Permalink
Use vitest (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Jan 13, 2023
1 parent c5ca107 commit cb5d6f0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
name: Tests
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [14.x, 16.x, 18.x, 19.x]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
Expand All @@ -35,7 +35,7 @@ jobs:
- name: Run tests
run: npm run tests-only
- name: Submit coverage
if: matrix.node-version == '16.x'
if: matrix.node-version == '18.x'
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,19 @@
"scripts": {
"prepare": "rollup -c",
"lint": "eslint .",
"test": "npm run prepare && npm run tests-only && npm run lint",
"tests-only": "jest --testMatch '**/test/*.js' --coverage"
"test": "npm run tests-only && npm run lint",
"tests-only": "vitest run --coverage"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"@vitest/coverage-c8": "^0.27.1",
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.22.0",
"jest": "^29.2.0",
"rollup": "^3.2.2",
"rollup-plugin-typescript2": "^0.34.0",
"typescript": "^4.0.2"
"rollup": "^3.8.1",
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^4.0.2",
"vitest": "^0.27.1"
}
}
5 changes: 3 additions & 2 deletions test/index.js → src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const assert = require('assert');
const parseChatMarkup = require('..').default;
import assert from 'assert';
import { describe, it } from 'vitest';
import parseChatMarkup from './index.ts';

describe('parseChatMarkup', () => {
const bareOptions = {};
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ export default function parse(message: string, options: MarkupOptions = {}): Mar
return { type: 'link', text: token.text, href: httpify(token.text) };
case TokenType.Text:
return token.text;
/* istanbul ignore next */
/* c8 ignore next 2 */
default:
throw new Error('unreachable');
}
Expand Down
7 changes: 7 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
test: {
coverage: {
reporter: ['text', 'lcov', 'html'],
},
},
};

0 comments on commit cb5d6f0

Please sign in to comment.