Permalink
Browse files

Internal: add "actual" test output files to make diff easier

  • Loading branch information...
1 parent b7fe686 commit 4d3266a35841f3a6baceb5483e145cb607496d2e @MoOx committed Mar 12, 2016
Showing with 18 additions and 3 deletions.
  1. +1 −0 .gitignore
  2. +7 −3 src/__tests__/option.features.js
  3. +10 −0 src/__tests__/utils/index.js
View
@@ -4,3 +4,4 @@ node_modules
# build
lib
docs/dist
+src/__tests__/fixtures/**/*.actual.css
@@ -16,7 +16,8 @@ const testFeature = function(
feature,
source,
input,
- expected
+ expected,
+ slug
) {
const options = { features: { } }
@@ -40,8 +41,11 @@ const testFeature = function(
// enable only the one we want to test...
options.features[feature] = true
+ const actual = cssnext(options).process(input).css.trim()
+ utils.write(utils.fixturePath(join("features", slug + ".actual")), actual)
+
t.equal(
- cssnext(options).process(input).css.trim(),
+ actual,
expected.trim(),
"should add " + feature + " support"
)
@@ -54,7 +58,7 @@ Object.keys(features).forEach(function(name) {
const expected = utils.readFixture(join("features", slug + ".expected"))
test(slug, function(t) {
- testFeature(t, name, source, input, expected)
+ testFeature(t, name, source, input, expected, slug)
t.end()
})
@@ -30,4 +30,14 @@ export default {
readFixture(name, ext) {
return fs.readFileSync(this.fixturePath(name, ext), "utf8")
},
+
+ /**
+ * read a fixture
+ * @param {String} name
+ * @param {String} ext (optional extension, default to ".css")
+ * @return the fixture content
+ */
+ write(name, content) {
+ return fs.writeFileSync(name, content)
+ },
}

0 comments on commit 4d3266a

Please sign in to comment.