mirror of
https://github.com/cypress-io/cypress.git
synced 2026-02-19 05:31:40 -06:00
* wip [skip ci] update * wip [skip ci] update test * [skip ci] fix env var * bump sinon, create helper utility to always throw when a stub is called without being given stubbed behavior * update failing specs * fix some error messages * update snapshot * warning -> note, add snapshot tests * change snapshot os.release, test env vars
42 lines
1.1 KiB
JavaScript
42 lines
1.1 KiB
JavaScript
require('../spec_helper')
|
|
|
|
const fs = require(`${lib}/fs`)
|
|
const makeUserPackageFile = require('../../scripts/build')
|
|
const snapshot = require('snap-shot-it')
|
|
const la = require('lazy-ass')
|
|
const is = require('check-more-types')
|
|
const R = require('ramda')
|
|
|
|
const hasVersion = (json) =>
|
|
la(is.semver(json.version), 'cannot find version', json)
|
|
|
|
const hasAuthor = (json) =>
|
|
la(json.author === 'Brian Mann', 'wrong author name', json)
|
|
|
|
const changeVersion = R.assoc('version', 'x.y.z')
|
|
|
|
describe('package.json build', () => {
|
|
beforeEach(function () {
|
|
// stub package.json in CLI
|
|
// with a few test props
|
|
// the rest should come from root package.json file
|
|
sinon.stub(fs, 'readJsonAsync').resolves({
|
|
name: 'test',
|
|
engines: 'test engines',
|
|
})
|
|
sinon.stub(fs, 'outputJsonAsync').resolves()
|
|
})
|
|
|
|
it('author name and version', () => {
|
|
return makeUserPackageFile()
|
|
.tap(hasAuthor)
|
|
.tap(hasVersion)
|
|
})
|
|
|
|
it('outputs expected properties', () => {
|
|
return makeUserPackageFile()
|
|
.then(changeVersion)
|
|
.then(snapshot)
|
|
})
|
|
})
|