From 4c605e4d49d99222e98d48c50e0c44096ecac4ae Mon Sep 17 00:00:00 2001 From: Gleb Bahmutov Date: Sat, 9 Dec 2017 22:08:35 -0500 Subject: [PATCH] chore: initial code --- .eslintrc | 5 +++ .gitignore | 3 ++ .npmrc | 4 ++ .vscode/settings.json | 4 ++ README.md | 59 ++++++++++++++++++++++++++++++ issue_template.md | 12 ++++++ package.json | 85 +++++++++++++++++++++++++++++++++++++++++++ src/index.js | 5 +++ src/snapshot-spec.js | 12 ++++++ 9 files changed, 189 insertions(+) create mode 100644 .eslintrc create mode 100644 .gitignore create mode 100644 .npmrc create mode 100644 .vscode/settings.json create mode 100644 README.md create mode 100644 issue_template.md create mode 100644 package.json create mode 100644 src/index.js create mode 100644 src/snapshot-spec.js diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..b87bdb7 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,5 @@ +{ + "extends": [ + "plugin:cypress-dev/general" + ] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..625212a --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +.DS_Store +npm-debug.log diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..bb3a5b4 --- /dev/null +++ b/.npmrc @@ -0,0 +1,4 @@ +registry=http://registry.npmjs.org/ +save-exact=true +progress=false +package-lock=false diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4a1878c --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "standard.enable": false, + "eslint.enable": true +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..518d27d --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# @cypress/snapshot + +> Adds value / object / DOM element snapshot testing support to Cypress test runner + +[![NPM][npm-icon] ][npm-url] + +[![Build status][ci-image] ][ci-url] +[![semantic-release][semantic-image] ][semantic-url] + +## Install + +Requires [Node](https://nodejs.org/en/) version 6 or above. + +```sh +npm install --save-dev @cypress/snapshot +``` + +## Use + +### Small print + +Author: Gleb Bahmutov <gleb@cypress.io> © 2017 + +License: MIT - do anything with the code, but don't blame u if it does not work. + +Support: if you find any problems with this module, email / tweet / +[open issue](https://github.com/cypress-io/snapshot/issues) on Github + +## MIT License + +Copyright (c) 2017 Cypress.io <gleb@cypress.io> + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +[npm-icon]: https://nodei.co/npm/@cypress/snapshot.svg?downloads=true +[npm-url]: https://npmjs.org/package/@cypress/snapshot +[ci-image]: https://travis-ci.org/cypress-io/snapshot.svg?branch=master +[ci-url]: https://travis-ci.org/cypress-io/snapshot +[semantic-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg +[semantic-url]: https://github.com/semantic-release/semantic-release diff --git a/issue_template.md b/issue_template.md new file mode 100644 index 0000000..709221f --- /dev/null +++ b/issue_template.md @@ -0,0 +1,12 @@ +Thank you for taking time to open a new issue. Please answer a few questions to help us fix it faster. You can delete text that is irrelevant to the issue. + +## Is this a bug report or a feature request? + +If this is a bug report, please provide as much info as possible + +- version +- platform +- expected behavior +- actual behavior + +If this is a new feature request, please describe it below diff --git a/package.json b/package.json new file mode 100644 index 0000000..0064fa6 --- /dev/null +++ b/package.json @@ -0,0 +1,85 @@ +{ + "name": "@cypress/snapshot", + "description": "Adds value / object / DOM element snapshot testing support to Cypress test runner", + "version": "1.0.0", + "author": "Gleb Bahmutov ", + "bugs": "https://github.com/cypress-io/snapshot/issues", + "config": { + "pre-git": { + "commit-msg": "simple", + "pre-commit": [ + "npm prune", + "npm run deps", + "npm test", + "git add src/*.js", + "npm run ban" + ], + "pre-push": [ + "npm run unused-deps", + "npm run secure", + "npm run license", + "npm run ban -- --all", + "npm run size" + ], + "post-commit": [], + "post-merge": [] + } + }, + "engines": { + "node": ">=6" + }, + "files": [ + "src/*.js", + "!src/*-spec.js" + ], + "homepage": "https://github.com/cypress-io/snapshot#readme", + "keywords": [ + "cypress", + "cypress-io", + "plugin", + "snapshot", + "testing" + ], + "license": "MIT", + "main": "src/", + "private": false, + "publishConfig": { + "registry": "http://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "https://github.com/cypress-io/snapshot.git" + }, + "scripts": { + "ban": "ban", + "deps": "deps-ok && dependency-check --no-dev .", + "issues": "git-issues", + "license": "license-checker --production --onlyunknown --csv", + "lint": "eslint --fix src/*.js", + "pretest": "npm run lint", + "secure": "nsp check", + "size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";", + "test": "npm run unit", + "unit": "mocha src/*-spec.js", + "unused-deps": "dependency-check --unused --no-dev ." + }, + "release": { + "analyzeCommits": "simple-commit-message" + }, + "devDependencies": { + "ban-sensitive-files": "1.9.2", + "dependency-check": "2.9.1", + "deps-ok": "1.2.1", + "eslint": "4.13.0", + "eslint-plugin-cypress-dev": "1.1.2", + "git-issues": "1.3.1", + "license-checker": "15.0.0", + "mocha": "4.0.1", + "nsp": "3.1.0", + "pre-git": "3.16.0" + }, + "dependencies": { + "check-more-types": "2.24.0", + "lazy-ass": "1.6.0" + } +} diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..b929f37 --- /dev/null +++ b/src/index.js @@ -0,0 +1,5 @@ +'use strict' + + +module.exports = true + diff --git a/src/snapshot-spec.js b/src/snapshot-spec.js new file mode 100644 index 0000000..d0aa2ed --- /dev/null +++ b/src/snapshot-spec.js @@ -0,0 +1,12 @@ +'use strict' + +/* eslint-env mocha */ +const snapshot = require('.') +const la = require('lazy-ass') +const is = require('check-more-types') + +describe('@cypress/snapshot', () => { + it('is a function', () => { + la(is.fn(snapshot)) + }) +})