build: cleanup & add test infrastructure (#36)
* build: remove unused tslint config file * build: cleanup package.json * build(deps-dev): upgrade @types/fs-extra to 8.1.0 * build(deps-dev): remove unused electron devDependency * build(deps-dev): upgrade @types/node to ^13.7.7 * build(deps-dev): upgrade prettier to 1.19.1 * build(deps-dev): upgrade typescript to 3.8.3 * build: reformat .circleci/config.yml * test: add jest + a basic test for parseNotarizationInfo * build: don't compile test files by default
This commit is contained in:
Родитель
7d3485fc74
Коммит
3507bf0ec1
|
@ -1,38 +1,38 @@
|
|||
version: 2
|
||||
jobs:
|
||||
test:
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run: yarn --frozen-lockfile
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- run: yarn lint
|
||||
release:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run: yarn --frozen-lockfile
|
||||
- run: npx semantic-release
|
||||
test:
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run: yarn --frozen-lockfile
|
||||
- save_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
paths:
|
||||
- ./node_modules
|
||||
- run: yarn lint
|
||||
- run: yarn test
|
||||
release:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
key: dependency-cache-{{ checksum "yarn.lock" }}
|
||||
- run: yarn --frozen-lockfile
|
||||
- run: npx semantic-release
|
||||
workflows:
|
||||
version: 2
|
||||
test_and_release:
|
||||
# release when tests are successful
|
||||
jobs:
|
||||
version: 2
|
||||
test_and_release:
|
||||
# release when tests are successful
|
||||
jobs:
|
||||
- test
|
||||
- release:
|
||||
requires:
|
||||
- test
|
||||
- release:
|
||||
requires:
|
||||
- test
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
12
package.json
12
package.json
|
@ -9,20 +9,22 @@
|
|||
"scripts": {
|
||||
"build": "tsc",
|
||||
"lint": "prettier --check \"src/**/*.ts\"",
|
||||
"prepublish": "yarn build"
|
||||
"prepare": "yarn build",
|
||||
"test": "jest"
|
||||
},
|
||||
"files": [
|
||||
"lib",
|
||||
"README.md"
|
||||
"lib"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@continuous-auth/semantic-release-npm": "^2.0.0",
|
||||
"@types/debug": "^4.1.5",
|
||||
"@types/fs-extra": "^8.0.1",
|
||||
"@types/node": "^12.12.5",
|
||||
"electron": "^7.0.1",
|
||||
"@types/jest": "^25.1.4",
|
||||
"@types/node": "^13.7.7",
|
||||
"jest": "^25.1.0",
|
||||
"prettier": "^1.18.2",
|
||||
"semantic-release": "^15.13.18",
|
||||
"ts-jest": "^25.2.1",
|
||||
"typescript": "^3.6.4"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import { parseNotarizationInfo } from '../src/helpers';
|
||||
|
||||
describe('helpers', () => {
|
||||
describe('parseNotarizationInfo', () => {
|
||||
test('build a NotarizationInfo object', () => {
|
||||
const output = `
|
||||
RequestUUID: 123
|
||||
Date: 2020-01-01
|
||||
Status: unknown
|
||||
`;
|
||||
expect(parseNotarizationInfo(output)).toEqual({
|
||||
date: new Date('2020-01-01'),
|
||||
status: 'unknown',
|
||||
uuid: '123',
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -14,5 +14,8 @@
|
|||
"declaration": true,
|
||||
"skipDefaultLibCheck": true,
|
||||
"skipLibCheck": true,
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"extends": "tslint-config-airbnb",
|
||||
"rules": {
|
||||
"max-line-length": false,
|
||||
"align": false,
|
||||
"import-name": false,
|
||||
"strict-boolean-expressions": false
|
||||
}
|
||||
}
|
2821
yarn.lock
2821
yarn.lock
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче