Skip to content

Commit

Permalink
fix(gatsby-cypress): Run files through babel (#12400)
Browse files Browse the repository at this point in the history
* Move files, add babel transform

* Add node env note in README
  • Loading branch information
LekoArts authored and sidharthachatterjee committed Mar 8, 2019
1 parent 6af0da0 commit bf7fe7f
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/gatsby-cypress/.babelrc
@@ -0,0 +1,5 @@
{
"presets": [
["babel-preset-gatsby-package"]
]
}
1 change: 1 addition & 0 deletions packages/gatsby-cypress/.gitignore
@@ -0,0 +1 @@
/*.js
34 changes: 34 additions & 0 deletions packages/gatsby-cypress/.npmignore
@@ -0,0 +1,34 @@
# Logs
logs
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directory
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
node_modules
*.un~
yarn.lock
src
flow-typed
coverage
decls
examples
6 changes: 6 additions & 0 deletions packages/gatsby-cypress/README.md
Expand Up @@ -8,6 +8,12 @@ as follows:
import "gatsby-cypress/commands"
```

You also need to expose a `CYPRESS_SUPPORT` environment variable to entirely eliminate any code relating to Cypress in the normal browser build. You can place it in your test script for example:

```
"test": "CYPRESS_SUPPORT=y npm run build && npm run start-server-and-test"
```

Once imported, the following additional commands are available:

- `cy.getTestElement(selector)`: Selects elements where the `data-testid`
Expand Down
16 changes: 15 additions & 1 deletion packages/gatsby-cypress/package.json
Expand Up @@ -9,6 +9,15 @@
"bugs": {
"url": "https://github.com/gatsbyjs/gatsby/issues"
},
"dependencies": {
"@babel/runtime": "^7.0.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"babel-preset-gatsby-package": "^0.1.3",
"cross-env": "^5.1.4"
},
"keywords": [
"gatsby",
"cypress",
Expand All @@ -19,5 +28,10 @@
"cypress": "^3.1.0",
"gatsby": "^2.0.0-rc.13"
},
"readme": "README.md"
"readme": "README.md",
"scripts": {
"build": "babel src --out-dir . --ignore **/__tests__",
"prepare": "cross-env NODE_ENV=production npm run build",
"watch": "babel -w src --out-dir . --ignore **/__tests__"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit bf7fe7f

Please sign in to comment.