Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade @cypress/browserify-preprocessor to 2.1.0 #4308

Merged
merged 3 commits into from
May 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ describe "src/cy/commands/assertions", ->
expect(cy.$$('button:first')).to.have.focus
cy.get('button:first').should('have.focus')
.then ->
expect(stub).to.be.calledTwice
expect(stub).to.be.calledThrice

context "match", ->
beforeEach ->
Expand Down
17 changes: 17 additions & 0 deletions packages/server/__snapshots__/5_stdout_spec.coffee.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,23 @@ Fix the error in your code and re-run your tests.
└─────────────────────────────────────────────────────┘


Oops...we found an error preparing this test file:

/foo/bar/.projects/e2e/cypress/support/index.js

The error was:

<anonymous>:1:2: error: unexpected >
+>
^

This occurred while Cypress was compiling and bundling your test code. This is usually caused by:

- A missing file or dependency
- A syntax error in the file or one of its dependencies

Fix the error in your code and re-run your tests.

(Video)

- Started processing: Compressing to 32 CRF
Expand Down
5 changes: 3 additions & 2 deletions packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
"chokidar-cli": "1.2.2",
"chrome-har-capturer": "0.13.4",
"coffee-coverage": "1.0.1",
"coffeeify": "3.0.1",
"coffeescript": "1.12.7",
"console-table-printer": "1.0.0-beta12",
"cors": "2.8.5",
"coveralls": "2.13.3",
Expand Down Expand Up @@ -97,7 +99,7 @@
"xvfb-maybe": "cypress-io/xvfb-maybe#c4a810c42d603949cd63b8cf245f6c239331d370"
},
"dependencies": {
"@cypress/browserify-preprocessor": "1.1.2",
"@cypress/browserify-preprocessor": "2.1.0",
"@cypress/commit-info": "2.1.3",
"@cypress/get-windows-proxy": "1.5.4",
"@cypress/icons": "0.7.0",
Expand All @@ -110,7 +112,6 @@
"chalk": "2.4.2",
"check-more-types": "2.24.0",
"chokidar": "1.7.0",
"cjsxify": "0.3.0",
"cli-table2": "0.2.0",
"color-string": "1.5.3",
"common-tags": "1.8.0",
Expand Down
32 changes: 22 additions & 10 deletions packages/server/test/integration/http_requests_spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ zlib = require("zlib")
str = require("underscore.string")
browserify = require("browserify")
babelify = require("babelify")
cjsxify = require("cjsxify")
coffeeify = require("coffeeify")
streamToPromise = require("stream-to-promise")
evilDns = require("evil-dns")
Promise = require("bluebird")
Expand Down Expand Up @@ -40,13 +40,25 @@ removeWhitespace = (c) ->
c = str.lines(c).join(" ")
c

sourceMapRegex = /\n\/\/# sourceMappingURL\=.*/

removeSourceMapContents = (fileContents) ->
fileContents.replace(sourceMapRegex, ";")

browserifyFile = (filePath) ->
streamToPromise(
browserify(filePath)
.transform(cjsxify)
.transform(babelify, {
plugins: ["add-module-exports", "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-runtime"],
presets: ["@babel/preset-env", "@babel/preset-react"],
browserify({
entries: [filePath]
extensions: ['.js', '.jsx', '.coffee']
cache: {}
packageCache: {}
transform: [
[coffeeify, {}]
[babelify, {
plugins: ["add-module-exports", "@babel/plugin-proposal-class-properties", "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-runtime"],
presets: ["@babel/preset-env", "@babel/preset-react"],
}]
]
})
.bundle()
)
Expand Down Expand Up @@ -454,7 +466,7 @@ describe "Routes", ->

browserifyFile(Fixtures.path("projects/ids/cypress/integration/foo.coffee"))
.then (file) ->
expect(res.body).to.equal file.toString()
expect(removeSourceMapContents(res.body)).to.equal(file.toString())

it "processes dom.jsx spec", ->
@rp("http://localhost:2020/__cypress/tests?p=cypress/integration/baz.js")
Expand All @@ -463,7 +475,7 @@ describe "Routes", ->

browserifyFile(Fixtures.path("projects/ids/cypress/integration/baz.js"))
.then (file) ->
expect(res.body).to.equal file.toString()
expect(removeSourceMapContents(res.body)).to.equal(file.toString())
expect(res.body).to.include("React.createElement(")

it "serves error javascript file when the file is missing", ->
Expand Down Expand Up @@ -507,7 +519,7 @@ describe "Routes", ->

browserifyFile(Fixtures.path("projects/no-server/my-tests/test1.js"))
.then (file) ->
expect(res.body).to.equal file.toString()
expect(removeSourceMapContents(res.body)).to.equal(file.toString())

it "processes helpers/includes.js javascripts", ->
@rp("http://localhost:2020/__cypress/tests?p=helpers/includes.js")
Expand All @@ -516,7 +528,7 @@ describe "Routes", ->

browserifyFile(Fixtures.path("projects/no-server/helpers/includes.js"))
.then (file) ->
expect(res.body).to.equal file.toString()
expect(removeSourceMapContents(res.body)).to.equal(file.toString())

context "ALL /__cypress/xhrs/*", ->
beforeEach ->
Expand Down