chore: change transpile target to es2015 for internal code / specs (#8597)

* change transpile target to es2015

* fix specs

* update snapshots

* rename mocha patch
This commit is contained in:
Ben Kucera
2020-09-24 17:17:22 -04:00
committed by GitHub
parent e62dd8d5e5
commit 12b6c2682a
10 changed files with 35 additions and 13 deletions
@@ -237,7 +237,7 @@ describe('src/cy/commands/clock', () => {
const newWindow = {
setTimeout () {},
clearTimeout () {},
Date () {},
Date: function Date () {},
XMLHttpRequest: {
prototype: {},
},
@@ -42,7 +42,7 @@ describe('return values', () => {
it('stringifies function bodies', (done) => {
cy.on('fail', (err) => {
expect(err.message).to.include('> function')
expect(err.message).to.include('\n> () => {')
expect(err.message).to.include(`return 'foo';`)
expect(err.message).to.include('Cypress detected that you invoked one or more cy commands but returned a different value.')
expect(err.docsUrl).to.eq('https://on.cypress.io/returning-value-and-commands-in-test')
@@ -102,7 +102,7 @@ describe('return values', () => {
expect(lastLog.get('name')).to.eq('foo')
expect(lastLog.get('error')).to.eq(err)
expect(err.message).to.include('> `cy.foo()`')
expect(err.message).to.include('> function () {')
expect(err.message).to.include('> () => {')
expect(err.message).to.include(`return 'bar';`)
expect(err.message).to.include('Cypress detected that you invoked one or more cy commands in a custom command but returned a different value.')
+1 -1
View File
@@ -23,7 +23,7 @@
"@types/chalk": "^2.2.0",
"@types/common-tags": "^1.8.0",
"@types/lodash": "^4.14.123",
"@types/mocha": "^5.2.6",
"@types/mocha": "^8.0.3",
"angular": "1.8.0",
"backbone": "1.4.0",
"basic-auth": "2.0.1",
@@ -0,0 +1,13 @@
diff --git a/node_modules/mocha/lib/mocha.js b/node_modules/mocha/lib/mocha.js
index 0b43004..588e195 100644
--- a/node_modules/mocha/lib/mocha.js
+++ b/node_modules/mocha/lib/mocha.js
@@ -853,7 +853,7 @@ Mocha.prototype.run = function(fn) {
options.files = this.files;
var runner = new exports.Runner(suite, options.delay);
createStatsCollector(runner);
- var reporter = new this._reporter(runner, options);
+ var reporter = this._reporter(runner, options);
runner.checkLeaks = options.checkLeaks === true;
runner.fullStackTrace = options.fullTrace;
runner.asyncOnly = options.asyncOnly;
@@ -722,13 +722,15 @@ module.exports = {
The return value was:
> ${obj.returned}
> {{returned}}
Because cy commands are asynchronous and are queued to be run later, it doesn't make sense to return anything else.
For convenience, you can also simply omit any return value or return \`undefined\` and Cypress will not error.
In previous versions of Cypress we automatically detected this and forced the cy commands to be returned. To make things less magical and clearer, we are now throwing an error.`,
In previous versions of Cypress we automatically detected this and forced the cy commands to be returned. To make things less magical and clearer, we are now throwing an error.`
// since obj.returned can be multi-lined, it can mess up stripIndent, so we replace it after
.replace('{{returned}}', obj.returned),
docsUrl: 'https://on.cypress.io/returning-value-and-commands-in-custom-command',
}
},
@@ -739,13 +741,15 @@ module.exports = {
The return value was:
> ${obj.returned}
> {{returned}}
Because cy commands are asynchronous and are queued to be run later, it doesn't make sense to return anything else.
For convenience, you can also simply omit any return value or return \`undefined\` and Cypress will not error.
In previous versions of Cypress we automatically detected this and forced the cy commands to be returned. To make things less magical and clearer, we are now throwing an error.`,
In previous versions of Cypress we automatically detected this and forced the cy commands to be returned. To make things less magical and clearer, we are now throwing an error.`
// since obj.returned can be multi-lined, it can mess up stripIndent, so we replace it after
.replace('{{returned}}', obj.returned),
docsUrl: 'https://on.cypress.io/returning-value-and-commands-in-test',
}
},
+1 -1
View File
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"target": "es5",
"target": "ES2016",
"module": "commonjs",
"allowJs": true,
"noImplicitAny": false,
@@ -29,7 +29,7 @@ exports['e2e return value failing1 1'] = `
The return value was:
> {}, 1, 2, foo, function(){}
> {}, 1, 2, foo, function(){}
Because cy commands are asynchronous and are queued to be run later, it doesn't make sense to return anything else.
@@ -2374,7 +2374,7 @@ exports['e2e record passing passes 2'] = [
"An uncaught error was detected outside of a test"
],
"state": "failed",
"body": "function throwErr() {\n throw err;\n }",
"body": "() => {\n throw err;\n }",
"displayError": "Error: The following error originated from your test code, not from Cypress.\n\n > instantly fails\n\nWhen Cypress detects uncaught errors originating from your test code it will automatically fail the current test.\n\nCypress could not associate this error to any specific test.\n\nWe dynamically generated a new test to display this failure.\n [stack trace lines]",
"attempts": [
{
+1 -1
View File
@@ -74,7 +74,7 @@ const getCommonConfig = () => {
[require.resolve('@babel/plugin-proposal-class-properties'), { loose: true }],
],
presets: [
require.resolve('@babel/preset-env'),
[require.resolve('@babel/preset-env'), { targets: { 'chrome': 63 } }],
require.resolve('@babel/preset-react'),
[require.resolve('@babel/preset-typescript'), { allowNamespaces: true }],
],
+6 -1
View File
@@ -4393,7 +4393,7 @@
resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.0.tgz#69a23a3ad29caf0097f06eda59b361ee2f0639f6"
integrity sha1-aaI6OtKcrwCX8G7aWbNh7i8GOfY=
"@types/mocha@5.2.7", "@types/mocha@^5.2.6":
"@types/mocha@5.2.7":
version "5.2.7"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-5.2.7.tgz#315d570ccb56c53452ff8638738df60726d5b6ea"
integrity sha512-NYrtPht0wGzhwe9+/idPaBB+TqkY9AhTvOLMkThm0IoEfLaiVQZwBwyJ5puCkO3AUCWrmcoePjp2mbFocKy4SQ==
@@ -4403,6 +4403,11 @@
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-7.0.2.tgz#b17f16cf933597e10d6d78eae3251e692ce8b0ce"
integrity sha512-ZvO2tAcjmMi8V/5Z3JsyofMe3hasRcaw88cto5etSVMwVQfeivGAlEYmaQgceUSVYFofVjT+ioHsATjdWcFt1w==
"@types/mocha@^8.0.3":
version "8.0.3"
resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.0.3.tgz#51b21b6acb6d1b923bbdc7725c38f9f455166402"
integrity sha512-vyxR57nv8NfcU0GZu8EUXZLTbCMupIUwy95LJ6lllN+JRPG25CwMHoB1q5xKh8YKhQnHYRAn4yW2yuHbf/5xgg==
"@types/mock-require@2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@types/mock-require/-/mock-require-2.0.0.tgz#57a4f0db0b4b6274f610a2d2c20beb3c842181e1"