mirror of
https://github.com/datashard/snapshot.git
synced 2024-11-22 06:02:29 +00:00
cleanup
This commit is contained in:
parent
0c8054b44f
commit
f10f29cf1d
3 changed files with 4 additions and 28 deletions
1
cypress/snapshots/Fixture-File.json
Normal file
1
cypress/snapshots/Fixture-File.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"foo":"bar","Fizzy Drink":"Soda"}
|
|
@ -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')
|
|
||||||
}
|
|
|
@ -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
|
||||||
};
|
}
|
||||||
|
|
Loading…
Reference in a new issue