Skip to content

Commit

Permalink
Add test to lint
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jan 22, 2024
1 parent b418271 commit 39339e6
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 318 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
tsconfigRootDir: __dirname,
project: './tsconfig.json',
project: './tsconfig.lint.json',
},
rules: {
'@typescript-eslint/no-unused-vars': [
Expand Down Expand Up @@ -71,5 +71,6 @@ module.exports = {
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"test": "jest",
"coverage": "npm test -- --coverage",
"lint": "eslint --ext .js,.ts src",
"lint": "eslint --ext .js,.ts src test",
"clean": "rimraf dist esm",
"prebuild": "npm run clean && npm run lint",
"build:esm": "tsc --target es2018 --outDir esm",
Expand Down Expand Up @@ -55,10 +55,10 @@
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-unicorn": "^49.0.0",
"eslint-plugin-unicorn": "^50.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.5.0",
"prettier": "^3.1.1",
"prettier": "^3.2.4",
"rimraf": "^5.0.1",
"standard-changelog": "^5.0.0",
"ts-jest": "^29.1.1",
Expand Down
10 changes: 5 additions & 5 deletions test/tabixindexedfile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test('can read ctgA:1000..4000', async () => {

const headerString = await f.getHeader()
expect(headerString.length).toEqual(10431)
expect(headerString[headerString.length - 1]).toEqual('\n')
expect(headerString.at(-1)).toEqual('\n')

expect(await f.getMetadata()).toEqual({
columnNumbers: { end: 0, ref: 1, start: 2 },
Expand Down Expand Up @@ -140,7 +140,7 @@ test('can query volvox.sort.gff3.gz.1', async () => {
})

const headerString = await f.getHeader()
expect(headerString[headerString.length - 1]).toEqual('\n')
expect(headerString.at(-1)).toEqual('\n')
expect(headerString.length).toEqual(130)

const lines = new RecordCollector()
Expand Down Expand Up @@ -173,7 +173,7 @@ test('can query gvcf.vcf.gz', async () => {

const headerString = await f.getHeader()
expect(headerString.length).toEqual(53)
expect(headerString[headerString.length - 1]).toEqual('\n')
expect(headerString.at(-1)).toEqual('\n')

const lines = [] as string[]
await f.getLines('ctgB', 0, Infinity, l => lines.push(l))
Expand Down Expand Up @@ -238,7 +238,7 @@ test('can query test.vcf.gz with a CSI index', async () => {

const headerString = await f.getHeader()
expect(headerString.length).toEqual(2560)
expect(headerString[headerString.length - 1]).toEqual('\n')
expect(headerString.at(-1)).toEqual('\n')

const lines = new RecordCollector()
await f.getLines('ctgB', 0, Infinity, lines.callback)
Expand Down Expand Up @@ -285,7 +285,7 @@ test('can fetch the entire header for a very large vcf header', async () => {
const h = await f.getHeader()
const lastBit = 'CN_105715_AGL\tCDC_QG-1_AGL\tCDC_SB-1_AGL\n'
expect(h.slice(h.length - lastBit.length, h.length)).toEqual(lastBit)
expect(h[h.length - 1]).toEqual('\n')
expect(h.at(-1)).toEqual('\n')
expect(h.length).toEqual(5315655)
})

Expand Down
4 changes: 4 additions & 0 deletions tsconfig.lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig",
"include": ["src", "test"]
}
Loading

0 comments on commit 39339e6

Please sign in to comment.