This commit is contained in:
Joshua 2022-09-13 16:03:57 +02:00
parent 0c8054b44f
commit f10f29cf1d
3 changed files with 4 additions and 28 deletions

View file

@ -0,0 +1 @@
{"foo":"bar","Fizzy Drink":"Soda"}

View file

@ -1,25 +0,0 @@
const debug = require('debug')('@cypress/snapshot')
const fs = require('fs')
const path = require('path')
const utils = require('./utils')
const amDependency = require('am-i-a-dependency')()
if (amDependency) {
// yes, do something interesting
// someone is executing "npm install foo"
debug('post install - in folder', process.cwd())
// we are in <owner>/node_modules/@cypress/snapshot
// but want to be simply in <owner> folder
const ownerFolder = path.normalize(path.join(process.cwd(), '..', '..', '..'))
const filename = path.join(ownerFolder, utils.SNAPSHOT_FILE_NAME)
if (!fs.existsSync(filename)) {
// save initial empty snapshot object
debug('writing initial file', filename)
fs.writeFileSync(filename, '{}\n')
} else {
debug('file %s already exists', filename)
}
} else {
debug('not a dependency install')
}

View file

@ -1,10 +1,10 @@
"use strict"; 'use strict'
// global cy, Cypress // global cy, Cypress
const { functions } = require("./utils/index"); const { functions } = require('./utils/index')
module.exports = { module.exports = {
register: functions.register, register: functions.register,
tasks: functions.tasks tasks: functions.tasks
}; }