csgo-gamestate-client
Advanced tools
Comparing version
@@ -6,2 +6,10 @@ module.exports = { | ||
testPathIgnorePatterns: ['/node_modules/'], | ||
coverageThreshold: { | ||
global: { | ||
branches: 100, | ||
functions: 100, | ||
lines: 100, | ||
statements: 100, | ||
}, | ||
}, | ||
} |
{ | ||
"name": "csgo-gamestate-client", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "", | ||
"main": "build/index.js", | ||
"types": "build/index.d.ts", | ||
"scripts": { | ||
"build": "rimraf ./build && tsc", | ||
"prepublish": "yarn build", | ||
"test": "jest" | ||
"prepare": "yarn build", | ||
"test": "jest --coverage", | ||
"lint": "eslint . --ext .ts", | ||
"prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write" | ||
}, | ||
"homepage": "https://github.com/Zeikko/csgo-gamestate-client", | ||
"bugs": { | ||
"url": "https://github.com/Zeikko/csgo-gamestate-client/issues" | ||
}, | ||
"keywords": [], | ||
@@ -15,4 +22,11 @@ "author": "Jaakko Ojalehto", | ||
"devDependencies": { | ||
"@types/jest": "^26.0.20", | ||
"@types/node": "^14.14.25", | ||
"@typescript-eslint/eslint-plugin": "^4.15.0", | ||
"@typescript-eslint/parser": "^4.15.0", | ||
"eslint": "^7.19.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"jest": "^26.6.3", | ||
"prettier": "^2.2.1", | ||
"rimraf": "^3.0.2", | ||
@@ -22,6 +36,3 @@ "ts-jest": "^26.5.1", | ||
"typescript": "^4.1.4" | ||
}, | ||
"dependencies": { | ||
"@types/jest": "^26.0.20" | ||
} | ||
} |
@@ -1,8 +0,8 @@ | ||
import { getGamestate, setGamestate } from './index' | ||
import { parseGameState } from './index' | ||
import { playingGameState } from './fixtures/gamestate' | ||
describe('index.ts', () => { | ||
it('sets gamestate and gets gamestate', () => { | ||
setGamestate('test') | ||
expect(getGamestate()).toEqual('test') | ||
describe('parseGameState', () => { | ||
it('parses gamestate and gets gamestate', () => { | ||
expect(parseGameState(playingGameState)).toMatchSnapshot() | ||
}) | ||
}) | ||
}) |
@@ -1,16 +0,7 @@ | ||
interface Gamestate { | ||
export interface GameState { | ||
round: number | ||
} | ||
let gamestate: Gamestate | null = null | ||
export const setGamestate = (newGamestate: string) => { | ||
gamestate = newGamestate | ||
export const parseGameState = (newGameState: string): GameState => { | ||
return JSON.parse(newGameState) as GameState | ||
} | ||
export const getGamestate = (): Gamestate => { | ||
if (gamestate === null) { | ||
throw new Error('Gamestate has not been set yet. Please call "setGamestate" before "getGamestate"') | ||
} | ||
return gamestate | ||
} |
@@ -11,7 +11,10 @@ { | ||
"resolveJsonModule": true, | ||
"rootDir": ".", | ||
"rootDir": "src/", | ||
"strict": true, | ||
"target": "ES2019" | ||
"target": "ES2019", | ||
"declaration": true, | ||
"composite": false, | ||
"declarationMap": true | ||
}, | ||
"exclude": ["node_modules", "**/*.test.ts", "build"] | ||
"exclude": ["node_modules", "**/*.test.ts", "build", "*.js", "coverage/**", "src/fixtures/**"] | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
23747
708%0
-100%15
66.67%513
677.27%0
-100%1
-50%1
-50%27
Infinity%13
116.67%1
Infinity%- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed