-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(all): Refactor into Jest idioms, adding integration tests (#714)
* Unify test patterns under Jest idioms, with selective assertions that are much more readable. * Improve the concurrency of the tests by reducing/removing synchronous operations that block an entire process. * Set the stage for async/await with libraries that have an easy migration path (execa, fs-promise, etc). ### `test/*` * Use `jest.mock()` where it makes sense, targeted `jest.fn()` otherwise * Convert `assert` -> `expect` ### `test/integration` * run CLI integration tests after unit tests * add concurrent InitCommand integration tests * add concurrent BootstrapCommand integration tests ### `test/helpers` * add `callsBack` * add `initDirName` * add `updateLernaConfig` * add `normalizeRelativeDir` * add `replaceLernaVersion` snapshot serializer * refactor library usage - Use fs-promise instead of cpr - Use execa instead of child_process - Use fs-promise instead of graceful-fs, cpr, rimraf, and mkdirp ### `src/**` * BootstrapCommand: move batchedPackages filtering into initialize() * BootstrapCommand: PackageUtilities.getFilteredPackage() -> isHoistedPackage() * Command: pass rootPath to GitUtilities.isInitialized() * DiffCommand: pass opts.cwd to spawn() with refactored args construction * FileSystemUtilities: .toString() on utf8 readFileSync is redundant * FileSystemUtilities: remove unused mkdirSync() method * FileSystemUtilities: split posix and windows guts of symlink methods for clarity * GitUtilities: init() and isInitialized() pass opts.cwd from parameter * GitUtilities: remove unused getTopLevelDirectory() method * InitCommand: check repository.initVersion instead of existsSync() * InitCommand: pass rootPath to GitUtilities.{isInitialized,init}() * InitCommand: refactor JSON serialization with libraries * NpmUtilities: extract dependencyIsSatisfied() method into separate file * NpmUtilities: splitVersion() does not need to be public * NpmUtilities: use read-pkg when reading package.json * NpmUtilities: use write-pkg when writing package.json * Package: add .toJSON() method, replacing .toJsonString() method * PackageUtilities: rename getFilteredPackage() -> isHoistedPackage() * PackageUtilities: privatize filterPackages() method * PackageUtilities: refactor getPackage() internals * PackageUtilities: remove getFilteredPackage() method * PublishCommand: don't pass GitUtilities.addFile directly to a forEach * PublishCommand: refactor JSON serialization with libraries * Repository: use read-pkg instead of load-json-file for package.json * utils/dependencyIsSatisfied: extract from NpmUtilities ### Dependencies Added * `execa` * `fs-promise` * `read-pkg` * `write-json-file` * `write-pkg` ### Dependencies Removed * `babel-register` * `cpr` * `mkdirp` (explicit) * `object-assign-sorted` * `pify` (explicit) ### Dependencies Updated * `babel-cli` * `babel-preset-es2015` * `inquirer` * `normalize-newline` * `normalize-path` (moved to `devDependencies`) * `path-exists`
- Loading branch information
Showing
69 changed files
with
4,609 additions
and
3,189 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,3 +28,4 @@ tmp | |
coverage/ | ||
.nyc_output/ | ||
.eslintcache | ||
*.tgz |
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
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
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
Oops, something went wrong.