Skip to content

Commit e1a2275

Browse files
committed
test(e2e): add editing .babelrc case
1 parent 343612e commit e1a2275

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

e2e-tests/development-runtime/cypress/integration/functionality/babelrc.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,24 @@ describe(`babelrc`, () => {
88
.invoke(`text`)
99
.should(`eq`, `babel-rc-is-used`)
1010
})
11+
12+
describe(`hot reload`, () => {
13+
it(`editing .babelrc`, () => {
14+
cy.visit(`/babelrc/edit/`).waitForRouteChange()
15+
16+
cy.getTestElement(TEST_ELEMENT)
17+
.invoke(`text`)
18+
.should(`eq`, `babel-rc-initial`)
19+
20+
cy.exec(
21+
`npm run update -- --file src/pages/babelrc/edit/index.js --replacements "babel-rc-test:babel-rc-edited" --exact`
22+
)
23+
24+
cy.waitForHmr()
25+
26+
cy.getTestElement(TEST_ELEMENT)
27+
.invoke(`text`)
28+
.should(`eq`, `babel-rc-edited`)
29+
})
30+
})
1131
})
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-initial",
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 BabelrcEdit() {
4+
return (
5+
<>
6+
<p>
7+
Code block below should contain <code>babel-rc-edited</code> first and
8+
after edit it should contain <code>babel-rc-edited</code>
9+
</p>
10+
<pre data-testid="test-element">babel-rc-edited</pre>
11+
</>
12+
)
13+
}

0 commit comments

Comments
 (0)