decaffeinate: Run post-processing cleanups on 3_plugins_spec.coffee

This commit is contained in:
decaffeinate
2020-02-25 09:24:18 -05:00
committed by Chris Breiding
parent a9c88d4dec
commit 657581f16e
+66 -71
View File
@@ -1,129 +1,124 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const path = require("path");
const path = require('path')
const e2e = require("../support/helpers/e2e");
const Fixtures = require("../support/helpers/fixtures");
const e2e = require('../support/helpers/e2e')
const Fixtures = require('../support/helpers/fixtures')
const pluginExtension = Fixtures.projectPath("plugin-extension");
const pluginConfig = Fixtures.projectPath("plugin-config");
const pluginFilterBrowsers = Fixtures.projectPath("plugin-filter-browsers");
const workingPreprocessor = Fixtures.projectPath("working-preprocessor");
const pluginsAsyncError = Fixtures.projectPath("plugins-async-error");
const pluginsAbsolutePath = Fixtures.projectPath("plugins-absolute-path");
const pluginAfterScreenshot = Fixtures.projectPath("plugin-after-screenshot");
const pluginReturnsBadConfig = Fixtures.projectPath("plugin-returns-bad-config");
const pluginReturnsEmptyBrowsersList = Fixtures.projectPath("plugin-returns-empty-browsers-list");
const pluginReturnsInvalidBrowser = Fixtures.projectPath("plugin-returns-invalid-browser");
const pluginExtension = Fixtures.projectPath('plugin-extension')
const pluginConfig = Fixtures.projectPath('plugin-config')
const pluginFilterBrowsers = Fixtures.projectPath('plugin-filter-browsers')
const workingPreprocessor = Fixtures.projectPath('working-preprocessor')
const pluginsAsyncError = Fixtures.projectPath('plugins-async-error')
const pluginsAbsolutePath = Fixtures.projectPath('plugins-absolute-path')
const pluginAfterScreenshot = Fixtures.projectPath('plugin-after-screenshot')
const pluginReturnsBadConfig = Fixtures.projectPath('plugin-returns-bad-config')
const pluginReturnsEmptyBrowsersList = Fixtures.projectPath('plugin-returns-empty-browsers-list')
const pluginReturnsInvalidBrowser = Fixtures.projectPath('plugin-returns-invalid-browser')
describe("e2e plugins", function() {
e2e.setup();
describe('e2e plugins', () => {
e2e.setup()
it("passes", function() {
it('passes', function () {
return e2e.exec(this, {
spec: "app_spec.coffee",
spec: 'app_spec.coffee',
project: workingPreprocessor,
sanitizeScreenshotDimensions: true,
snapshot: true
});
});
snapshot: true,
})
})
it("fails", function() {
it('fails', function () {
return e2e.exec(this, {
spec: "app_spec.coffee",
spec: 'app_spec.coffee',
project: pluginsAsyncError,
sanitizeScreenshotDimensions: true,
snapshot: true,
expectedExitCode: 1
});
});
expectedExitCode: 1,
})
})
it("can modify config from plugins", function() {
it('can modify config from plugins', function () {
return e2e.exec(this, {
spec: "app_spec.coffee",
env: "foo=foo,bar=bar",
spec: 'app_spec.coffee',
env: 'foo=foo,bar=bar',
config: { pageLoadTimeout: 10000 },
project: pluginConfig,
sanitizeScreenshotDimensions: true,
snapshot: true
});
});
snapshot: true,
})
})
it("catches invalid viewportWidth returned from plugins", function() {
it('catches invalid viewportWidth returned from plugins', function () {
// the test project returns config object with a bad value
return e2e.exec(this, {
project: pluginReturnsBadConfig,
expectedExitCode: 1,
snapshot: true
});
});
snapshot: true,
})
})
it("catches invalid browsers list returned from plugins", function() {
it('catches invalid browsers list returned from plugins', function () {
return e2e.exec(this, {
project: pluginReturnsEmptyBrowsersList,
expectedExitCode: 1,
snapshot: true
});
});
snapshot: true,
})
})
it("catches invalid browser returned from plugins", function() {
it('catches invalid browser returned from plugins', function () {
return e2e.exec(this, {
project: pluginReturnsInvalidBrowser,
expectedExitCode: 1,
snapshot: true
});
});
snapshot: true,
})
})
it("can filter browsers from config", function() {
it('can filter browsers from config', function () {
return e2e.exec(this, {
project: pluginFilterBrowsers,
// the test project filters available browsers
// and returns a list with JUST Electron browser
// and we ask to run in Chrome
// thus the test should fail
browser: "chrome",
browser: 'chrome',
expectedExitCode: 1,
snapshot: true,
// we are interested in the actual filtered available browser name
// which should be "electron"
normalizeStdoutAvailableBrowsers: false
});
});
normalizeStdoutAvailableBrowsers: false,
})
})
e2e.it("works with user extensions", {
browser: "chrome",
spec: "app_spec.coffee",
e2e.it('works with user extensions', {
browser: 'chrome',
spec: 'app_spec.coffee',
headed: true,
project: pluginExtension,
sanitizeScreenshotDimensions: true,
snapshot: true
});
snapshot: true,
})
it("handles absolute path to pluginsFile", function() {
it('handles absolute path to pluginsFile', function () {
return e2e.exec(this, {
spec: "absolute_spec.coffee",
spec: 'absolute_spec.coffee',
config: {
pluginsFile: path.join(
pluginsAbsolutePath,
"cypress/plugins/index.js"
)
'cypress/plugins/index.js',
),
},
project: pluginsAbsolutePath,
sanitizeScreenshotDimensions: true,
snapshot: true
});
});
snapshot: true,
})
})
return it("calls after:screenshot for cy.screenshot() and failure screenshots", function() {
it('calls after:screenshot for cy.screenshot() and failure screenshots', function () {
return e2e.exec(this, {
spec: "after_screenshot_spec.coffee",
spec: 'after_screenshot_spec.coffee',
project: pluginAfterScreenshot,
sanitizeScreenshotDimensions: true,
snapshot: true,
expectedExitCode: 1
});
});
});
expectedExitCode: 1,
})
})
})