Skip to content

Commit 343612e

Browse files
committed
test(e2e): add base babelrc support tests for dev and prod
1 parent d97b009 commit 343612e

File tree

8 files changed

+90
-0
lines changed

8 files changed

+90
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const TEST_ELEMENT = `test-element`
2+
3+
describe(`babelrc`, () => {
4+
it(`Applies .babelrc`, () => {
5+
cy.visit(`/babelrc/base/`).waitForRouteChange()
6+
7+
cy.getTestElement(TEST_ELEMENT)
8+
.invoke(`text`)
9+
.should(`eq`, `babel-rc-is-used`)
10+
})
11+
})

e2e-tests/development-runtime/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.0",
55
"author": "Dustin Schau <dustin@gatsbyjs.com>",
66
"dependencies": {
7+
"babel-plugin-search-and-replace": "^1.1.0",
78
"gatsby": "^3.0.0-next.6",
89
"gatsby-image": "^3.0.0-next.0",
910
"gatsby-plugin-image": "^1.0.0-next.5",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"plugins": [
3+
[
4+
"babel-plugin-search-and-replace",
5+
{
6+
"rules": [
7+
{
8+
"search": "babel-rc-test",
9+
"replace": "babel-rc-is-used",
10+
"searchTemplateStrings": true
11+
}
12+
13+
]
14+
}
15+
]
16+
],
17+
"presets": [
18+
"babel-preset-gatsby"
19+
]
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react"
2+
3+
export default function BabelrcBase() {
4+
return (
5+
<>
6+
<p>
7+
Code block below should contain <code>babel-rc-is-used</code> when
8+
compiled
9+
</p>
10+
<pre data-testid="test-element">babel-rc-test</pre>
11+
</>
12+
)
13+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const TEST_ELEMENT = `test-element`
2+
3+
describe(`babelrc`, () => {
4+
it(`Applies .babelrc`, () => {
5+
cy.visit(`/babelrc/base/`).waitForRouteChange()
6+
7+
cy.getTestElement(TEST_ELEMENT)
8+
.invoke(`text`)
9+
.should(`eq`, `babel-rc-is-used`)
10+
})
11+
})

e2e-tests/production-runtime/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"version": "1.0.0",
55
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
66
"dependencies": {
7+
"babel-plugin-search-and-replace": "^1.1.0",
78
"cypress": "^6.5.0",
89
"gatsby": "^3.0.0-next.6",
910
"gatsby-plugin-image": "^1.0.0-next.5",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"plugins": [
3+
[
4+
"babel-plugin-search-and-replace",
5+
{
6+
"rules": [
7+
{
8+
"search": "babel-rc-test",
9+
"replace": "babel-rc-is-used",
10+
"searchTemplateStrings": true
11+
}
12+
13+
]
14+
}
15+
]
16+
],
17+
"presets": [
18+
"babel-preset-gatsby"
19+
]
20+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from "react"
2+
3+
export default function BabelrcBase() {
4+
return (
5+
<>
6+
<p>
7+
Code block below should contain <code>babel-rc-is-used</code> when
8+
compiled
9+
</p>
10+
<pre data-testid="test-element">babel-rc-test</pre>
11+
</>
12+
)
13+
}

0 commit comments

Comments
 (0)