diff --git a/packages/driver/test/cypress/integration/commands/assertions_spec.coffee b/packages/driver/test/cypress/integration/commands/assertions_spec.coffee index 1460159703a8..1fd5f7dc16dd 100644 --- a/packages/driver/test/cypress/integration/commands/assertions_spec.coffee +++ b/packages/driver/test/cypress/integration/commands/assertions_spec.coffee @@ -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 -> diff --git a/packages/server/__snapshots__/5_stdout_spec.coffee.js b/packages/server/__snapshots__/5_stdout_spec.coffee.js index 3cbaab1866ac..e4e946fe82c0 100644 --- a/packages/server/__snapshots__/5_stdout_spec.coffee.js +++ b/packages/server/__snapshots__/5_stdout_spec.coffee.js @@ -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: + +: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 diff --git a/packages/server/package.json b/packages/server/package.json index 7bc177903ada..486692b8b4e3 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -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", @@ -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", @@ -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", diff --git a/packages/server/test/integration/http_requests_spec.coffee b/packages/server/test/integration/http_requests_spec.coffee index 33a839e29869..83910bd7a76b 100644 --- a/packages/server/test/integration/http_requests_spec.coffee +++ b/packages/server/test/integration/http_requests_spec.coffee @@ -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") @@ -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() ) @@ -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") @@ -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", -> @@ -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") @@ -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 ->