Skip to content

Commit

Permalink
Merge pull request #85 from lifeomic/convertTestsToAva
Browse files Browse the repository at this point in the history
Convert ava to jest and fix issues found.  Update type
  • Loading branch information
David Tanner authored Jul 7, 2023
2 parents b8d96d7 + 862a57e commit 014ed8c
Show file tree
Hide file tree
Showing 23 changed files with 3,455 additions and 4,695 deletions.
7 changes: 3 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"extends": [
"@lifeomic/standards/typescript",
"prettier",
"plugin:prettier/recommended"
"@lifeomic/standards"
],
"env": {
"commonjs": true,
"node": true
"node": true,
"jest": true
},
"parserOptions": {
"ecmaVersion": 2022
Expand Down
10 changes: 0 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,6 @@ on:
- master

jobs:
unpublish:
runs-on: ubuntu-latest
environment: npm
steps:
- env:
NPM_TOKEN: ${{ secrets.LIFEOMIC_NPM_TOKEN }}
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
- run: npm deprecate @lifeomic/abac@4.10.0 "Broken output"
- run: npm deprecate @lifeomic/abac@4.10.1 "Broken output"
- run: npm deprecate @lifeomic/abac@4.10.2 "Node version too high"
build:
runs-on: ubuntu-latest
environment: npm
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/node_modules/
/yarn-error.log
/.yarnclean
/browser/
.npmrc
/.vscode/
/test-report.xml
/.nyc_output
/coverage

src/**/*.js
src/**/*.cjs
Expand Down
31 changes: 31 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Config } from '@jest/types';
import inspector from 'inspector';

// If we are debugging then extend the timeout to max value, otherwise use the default.
const testTimeout = inspector.url() ? 1e8 : undefined;

const config: Config.InitialOptions = {
rootDir: __dirname,
coverageDirectory: '<rootDir>/coverage',
collectCoverageFrom: ['<rootDir>/src/**/*.ts'],
collectCoverage: true,
coverageThreshold: {
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
},
},
coveragePathIgnorePatterns: ['<rootDir>/test/', '/node_modules/'],
preset: 'ts-jest',
testEnvironment: 'node',
clearMocks: true,
restoreMocks: true,
resetMocks: true,
verbose: true,
testMatch: ['<rootDir>/test/**/*.test.ts'],
testTimeout,
};

export default config;
43 changes: 11 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@
"prepublishOnly": "yarn ts-node esBuild.ts && yarn tsc --project tsconfig.build.json",
"lint": "eslint src test",
"pretest": "yarn lint",
"test": "nyc ava --verbose",
"jenkins-test": "ENV=ava ava --tap | tap-xunit --package unit > test-report.xml"
"test": "jest"
},
"dependencies": {
"deep-clone": "^3.0.3",
"deep-equal": "^2.2.1"
},
"devDependencies": {
"@lifeomic/eslint-config-standards": "^3.0.0",
"@lifeomic/typescript-config": "^2.0.0",
"@jest/types": "^29.6.1",
"@lifeomic/eslint-config-standards": "^3.1.0",
"@lifeomic/typescript-config": "^3.0.0",
"@types/deep-equal": "^1.0.1",
"@types/jest": "^29.5.2",
"@types/lodash": "^4.5.7",
"@types/node": "^18",
"@types/semver": "^7.5.0",
"ajv": "^6.5.0",
"ava": "^3.15.0",
"ajv": "^8.12.0",
"browserslist": "^4.21.5",
"conventional-changelog-conventionalcommits": "^5.0.0",
"esbuild": "^0.17.18",
Expand All @@ -66,43 +66,22 @@
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.2.1",
"glob": "^10.2.3",
"nyc": "^11.8.0",
"jest": "^29.6.1",
"prettier": "^2.7.1",
"semantic-release": "^19.0.3",
"semver": "^7.5.0",
"sinon": "^5.0.7",
"tap-xunit": "^2.3.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5.1.6"
},
"peerDependencies": {
"ajv": ">=6.5.0"
},
"publishConfig": {
"access": "public"
},
"ava": {
"timeout": "30s",
"files": [
"test/**/*.test.ts"
],
"require": [
"ts-node/register/transpile-only"
],
"extensions": [
"ts",
"js"
],
"failWithoutAssertions": false,
"verbose": true,
"concurrency": 1,
"failFast": true
},
"nyc": {
"check-coverage": true,
"lines": 100,
"statements": 100,
"functions": 100,
"branches": 100
"resolutions": {
"jackspeak": "2.1.1"
}
}
Loading

0 comments on commit 014ed8c

Please sign in to comment.