Add options from cypress and jest-image-snapshot to cypress-image-snapshot (#41897)

* Add options from cypress and jest-image-snapshot to cypress-image-snapshot

* Use jest-image-snapshot from DefinitelyTyped

* Don't use relative paths to DefinitelyTyped modules

* Use TypeScript Version: 3.0 to match jest-image-snapshot

* inline jest-image-snapshot

* Don't use include

* Add dom to tsconfig

* Don't export MatchImageSnapshotOptions
This commit is contained in:
Alex Kessock
2020-01-28 09:57:03 -08:00
committed by Wesley Wigham
parent 31011673ab
commit 9785fa3b5a
4 changed files with 38 additions and 20 deletions
@@ -4,6 +4,7 @@ import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin';
// $ExpectType void
command.addMatchImageSnapshotCommand({
customSnapshotsDir: '../../test/cypress/snapshots',
scale: true,
});
addMatchImageSnapshotPlugin(() => null, {}); // $ExpectType void
+28 -10
View File
@@ -3,16 +3,34 @@
// Definitions by: Alex Kessock <https://github.com/Keysox>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Options {
customSnapshotsDir?: string;
customDiffDir?: string;
failureThreshold?: number;
failureThresholdType?: 'percent' | 'number';
customDiffConfig?: {
threshold: number;
};
capture?: 'viewport';
}
/// <reference types="Cypress" />
export interface Options
extends Partial<
Cypress.ScreenshotOptions & {
customDiffConfig?: {
readonly threshold?: number;
readonly includeAA?: boolean;
};
customSnapshotsDir?: string;
customDiffDir?: string;
customSnapshotIdentifier?:
| ((parameters: {
testPath: string;
currentTestName: string;
counter: number;
defaultIdentifier: string;
}) => string)
| string;
diffDirection?: 'horizontal' | 'vertical';
noColors?: boolean;
failureThreshold?: number;
failureThresholdType?: 'pixel' | 'percent';
updatePassedSnapshot?: boolean;
blur?: number;
runInProcess?: boolean;
}
> {}
declare global {
namespace Cypress {
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"cypress": "^3.8.3"
}
}
+3 -10
View File
@@ -1,23 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"cypress-image-snapshot-tests.ts"
]
"files": ["index.d.ts", "cypress-image-snapshot-tests.ts"]
}