jest-schema-matcher
Advanced tools
Comparing version 1.7.2 to 1.7.3
@@ -14,2 +14,3 @@ "use strict"; | ||
const pretty_format_1 = __importDefault(require("pretty-format")); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const { SHOULD_UPDATE_SCHEMAS } = global; | ||
@@ -23,2 +24,5 @@ /** | ||
function toMatchSchema(object, schemaName) { | ||
if (!lodash_1.default.isObjectLike(object)) { | ||
throw new TypeError(`Expected a valid object but received ${typeof object}: ${object}`); | ||
} | ||
const failureMessages = []; | ||
@@ -79,3 +83,3 @@ const schemaPath = findSchema(this.testPath, schemaName); | ||
function findSchema(testPath, schemaName) { | ||
const testDir = /.*\/(?=.+ts)/.exec(testPath)[0]; | ||
const testDir = testPath.replace(/[a-zA-z\d-_]+ts/, ''); | ||
const schemaDir = path_1.default.resolve(testDir, 'schemas'); | ||
@@ -139,4 +143,3 @@ const dirExists = checkIfFileExists(schemaDir); | ||
function createSchemaValidator(schema) { | ||
const ajv = new ajv_1.default({ schemaId: 'auto', allErrors: true }); | ||
return ajv.compile(schema); | ||
return new ajv_1.default({ schemaId: 'auto', allErrors: true }).compile(schema); | ||
} | ||
@@ -153,2 +156,5 @@ function validateAgainstSchema(schema, object) { | ||
const { errors } = validator; | ||
if (!errors) { | ||
throw new Error('Unexpected error: AJV did not provide validation violation details.'); | ||
} | ||
return errors.slice(0, 1).map(error => { | ||
@@ -155,0 +161,0 @@ const rejectedValue = pretty_format_1.default(eval(`_object${error.dataPath}`)); |
{ | ||
"name": "jest-schema-matcher", | ||
"version": "1.7.2", | ||
"version": "1.7.3", | ||
"license": "MIT", | ||
@@ -29,2 +29,23 @@ "files": [ | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"pre-push": "yarn test" | ||
} | ||
}, | ||
"lint-staged": { | ||
"./src/**/*": [ | ||
"xo src --fix" | ||
] | ||
}, | ||
"release": { | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/git", | ||
"@semantic-release/github" | ||
] | ||
}, | ||
"config": { | ||
@@ -35,4 +56,4 @@ "commitizen": { | ||
}, | ||
"engines": { | ||
"node": ">= 12.x" | ||
"resolutions": { | ||
"mem": "^4.0" | ||
}, | ||
@@ -42,14 +63,21 @@ "dependencies": { | ||
"chalk": "^4.1.0", | ||
"jest-matcher-utils": "^26.1.0", | ||
"pretty-format": "^26.1.0", | ||
"schematized": "^1.7.1", | ||
"jest-matcher-utils": "^26.3.0", | ||
"lodash": "^4.17.19", | ||
"pretty-format": "^26.3.0", | ||
"schematized": "^1.8.2", | ||
"variable-diff": "^2.0.1" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^26.0.4", | ||
"@types/node": "^14.0.22", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"@semantic-release/git": "^9.0.0", | ||
"@types/jest": "^26.0.9", | ||
"@types/lodash": "^4.14.159", | ||
"@types/node": "^14.0.27", | ||
"commitizen": "^4.1.2", | ||
"cz-conventional-changelog": "^3.2.0", | ||
"eslint-plugin-jest": "^23.18.0", | ||
"jest": "^26.1.0", | ||
"eslint-config-xo-typescript": "^0.32.0", | ||
"eslint-plugin-jest": "^23.20.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.3.0", | ||
"lint-staged": "^10.2.11", | ||
"nyc": "^15.1.0", | ||
@@ -59,6 +87,9 @@ "prettier": "^2.0.5", | ||
"semantic-release": "^17.1.1", | ||
"ts-jest": "^26.1.1", | ||
"typescript": "^3.9.6", | ||
"xo": "^0.32.1" | ||
"ts-jest": "^26.2.0", | ||
"typescript": "^3.9.7", | ||
"xo": "^0.33.0" | ||
}, | ||
"engines": { | ||
"node": ">= 12.x" | ||
}, | ||
"keywords": [ | ||
@@ -65,0 +96,0 @@ "jest", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18063
10
190
7
19
+ Addedlodash@^4.17.19
Updatedjest-matcher-utils@^26.3.0
Updatedpretty-format@^26.3.0
Updatedschematized@^1.8.2