Skip to content

Commit

Permalink
maybe this command will work in circle?
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Apr 2, 2021
1 parent 1076b1f commit ca69649
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const TEST_ELEMENT = `test-element`

after(() => {
before(() => {
cy.exec(`npm run reset`)
})

Expand Down Expand Up @@ -43,33 +43,8 @@ describe(`babelrc`, () => {
.invoke(`text`)
.should(`eq`, `babel-rc-test`)

const FILE_CONTENT = `
{
"plugins": [
[
"babel-plugin-search-and-replace",
{
"rules": [
{
"search": "babel-rc-test",
"replace": "babel-rc-added",
"searchTemplateStrings": true
}
]
}
]
],
"presets": [
"babel-preset-gatsby"
]
}
`

cy.exec(
`npm run update -- --file src/pages/babelrc/add/.babelrc --file-content '${JSON.stringify(
FILE_CONTENT
)}'`
`npm run update -- --file src/pages/babelrc/add/.babelrc --file-source src/pages/babelrc/add/.babelrc-fixture`
)

// babel-loader doesn't actually hot reloads itself when new .babelrc file is added
Expand Down
15 changes: 10 additions & 5 deletions e2e-tests/development-runtime/scripts/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ const args = yargs
).trim(),
type: `string`,
})
.option(`fileSource`, {
type: `string`,
})
.option(`restore`, {
default: false,
type: `boolean`,
Expand All @@ -64,11 +67,13 @@ async function update() {
let exists = true
if (!fs.existsSync(filePath)) {
exists = false
await fs.writeFile(
filePath,
JSON.parse(args.fileContent).replace(/\+n/g, `\n`),
`utf8`
)
let fileContent
if (args.fileSource) {
fileContent = await fs.readFile(args.fileSource, `utf8`)
} else if (args.fileContent) {
fileContent = JSON.parse(args.fileContent).replace(/\+n/g, `\n`)
}
await fs.writeFile(filePath, fileContent, `utf8`)
}
const file = await fs.readFile(filePath, `utf8`)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"plugins": [
[
"babel-plugin-search-and-replace",
{
"rules": [
{
"search": "babel-rc-test",
"replace": "babel-rc-added",
"searchTemplateStrings": true
}

]
}
]
],
"presets": [
"babel-preset-gatsby"
]
}

0 comments on commit ca69649

Please sign in to comment.