-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: use engines from CLI package, close #1373 * chore: add integration test for build script that writes package.json file * do not hardcode version * build npm package in this branch too
- Loading branch information
1 parent
d7dddc1
commit cf07e21
Showing
5 changed files
with
99 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
exports['package.json build outputs expected properties 1'] = { | ||
"name": "test", | ||
"engines": "test engines", | ||
"version": "x.y.z", | ||
"description": "Cypress.io end to end testing tool", | ||
"author": "Brian Mann", | ||
"homepage": "https://github.com/cypress-io/cypress", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/cypress-io/cypress/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/cypress-io/cypress.git" | ||
}, | ||
"types": "types", | ||
"scripts": { | ||
"postinstall": "node index.js --exec install", | ||
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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 | ||
this.sandbox.stub(fs, 'readJsonAsync').resolves({ | ||
name: 'test', | ||
engines: 'test engines', | ||
}) | ||
this.sandbox.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) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters