Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Add significantly more test coverage and various bug/doc fixes. #85

Merged
merged 1 commit into from
Feb 5, 2016

Conversation

ryan-roemer
Copy link
Member

Implementation work for #9

  • Add comprehensive "almost" functional tests in builder-core.spec.js using mock-fs and a
    ton of actual usage scenarios.
  • Capture JSON parsing errors for builder envs better.
  • Fix bug wherein builder --version displayed help instead of version.
  • Refactor --setup execution model to resolve and use a Task object straight up
    rather than a builder run <setup-task-name>.
  • Refactor config.js and log.js to have stubable methods in tests.
  • Enhance builder-core to take an options argument.
  • Fix minor README.md typo.

/cc @chaseadamsio @benbayard @baer @coopy @zachhale

@ryan-roemer ryan-roemer force-pushed the chore-more-tests branch 3 times, most recently from d86f11d to 598bbb7 Compare February 4, 2016 04:15
@@ -38,6 +38,11 @@ var Config = module.exports = function (cfg) {
this.scripts = this._loadScripts(this.archetypes);
};

// Expose `require()` for testing.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why this is done after reading your tests, but can you elaborate in this comment a little more? On first read it's very unclear why this additional logic is here. Just mentioning something like "require needs to be stubbed to work with mock filesystem in tests" would be helpful.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've got a more full explanation here -- https://github.com/FormidableLabs/builder/pull/85/files#diff-4ffc5fe4c4f93897ccc6fb2331ae5e44R56

Basically (1) fs mocking doesn't work with Node 4+, and (2) you want to defeat the require cache is what we mutate in the actual tests for our use cases.

But this code is mostly here to just allow the tests to decide how to override / stub...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why this is being done, I was just suggesting a tiny bit more explanation in the comment in this file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Implementation work for #9

* Add comprehensive "almost" functional tests in `builder-core.spec.js` using `mock-fs` and a
  ton of actual usage scenarios.
* Capture JSON parsing errors for `builder envs` better.
* Fix bug wherein `builder --version` displayed help instead of version.
* Refactor Task to take `runner` option to avoid circular dependencies.
* Refactor `--setup` execution model to resolve and use a `Task` object straight up
  rather than a `builder run <setup-task-name>`.
* Refactor `config.js` and `log.js` to have stubable methods in tests.
* Enhance `builder-core` to take an options argument.
* Fix minor README.md typo.
@ryan-roemer
Copy link
Member Author

Post-merge review welcome!

ryan-roemer added a commit that referenced this pull request Feb 5, 2016
Add significantly more test coverage and various bug/doc fixes.
@ryan-roemer ryan-roemer merged commit 501537c into master Feb 5, 2016
@ryan-roemer ryan-roemer deleted the chore-more-tests branch February 5, 2016 12:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants