Added Jest snapshot test files as generated src (#3572)

This commit is contained in:
Hank Brekke
2017-04-20 02:58:39 -05:00
committed by Colin Seymour
parent e80b92e407
commit f38d6bd124
3 changed files with 31 additions and 2 deletions

View File

@@ -81,7 +81,8 @@ module Linguist
generated_grammarkit? || generated_grammarkit? ||
generated_roxygen2? || generated_roxygen2? ||
generated_jison? || generated_jison? ||
generated_yarn_lock? generated_yarn_lock? ||
generated_jest_snapshot?
end end
# Internal: Is the blob an Xcode file? # Internal: Is the blob an Xcode file?
@@ -489,5 +490,15 @@ module Linguist
return false unless lines.count > 0 return false unless lines.count > 0
return lines[0].include?("# THIS IS AN AUTOGENERATED FILE") return lines[0].include?("# THIS IS AN AUTOGENERATED FILE")
end end
# Internal: Is this a Jest [snapshot test](https://facebook.github.io/jest/docs/snapshot-testing.html)
# file?
#
# Return true or false.
def generated_jest_snapshot?
return false unless extname == '.snap'
return false unless lines.count > 0
return lines[0].start_with?("// Jest Snapshot")
end
end end
end end

15
test/fixtures/Data/Jest.js.snap vendored Normal file
View File

@@ -0,0 +1,15 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`View renders correctly 1`] = `
<View
style={
Object {
"alignItems": "center",
"flex": 1,
"margin": 40,
"paddingLeft": 10,
"paddingRight": 10,
}
}
/>
`;

View File

@@ -79,9 +79,12 @@ class TestGenerated < Minitest::Test
generated_fixture_loading_data("Data/sourcemap.v3.map") generated_fixture_loading_data("Data/sourcemap.v3.map")
generated_fixture_loading_data("Data/sourcemap.v1.map") generated_fixture_loading_data("Data/sourcemap.v1.map")
# Yarn locfile # Yarn lockfile
generated_fixture_loading_data("Data/yarn.lock") generated_fixture_loading_data("Data/yarn.lock")
# Jest snapshot test
generated_fixture_loading_data("Data/Jest.js.snap")
# Specflow # Specflow
generated_fixture_without_loading_data("Features/BindingCulture.feature.cs") generated_fixture_without_loading_data("Features/BindingCulture.feature.cs")