-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Open
Labels
prevent-stalemark an issue so it is ignored by stale[bot]mark an issue so it is ignored by stale[bot]topic: fixturesFixture loading and usageFixture loading and usagetype: bugtype: featureNew feature that does not currently existNew feature that does not currently exist
Description
Current behavior:
Any attempt to use valid ES5 (e.g. var
, require
) let alone ES6 (import
, export
, const
) results in syntax errors, e.g.:
Error: 'admin.js' is not a valid JavaScript object.SyntaxError: Unexpected token var
Because this error occurred during a 'before each' hook we are skipping the remaining tests in the current suite: 'when login is valid'
The only "javascripty" construct that seems to be allowed is module.exports =
.
Desired behavior:
.js
fixtures should support valid JS syntax (ES6, preferably).
How to reproduce:
Create a fixture containing valid ES6 syntax
const user = 'Joe'
export default {
user,
}
Then use it:
cy.fixture('auth.js')
Result:
Error: 'auth.js' is not a valid JavaScript object.
auth.js:3
export default {
^
ParseError: Unexpected token
Create a fixture using valid ES5 code
var user = 'Joe';
module.exports = {
user: user
};
Result:
Error: 'auth.js' is not a valid JavaScript object.SyntaxError: Unexpected token var
- Operating System: Darwin Kernel Version 15.6.0: Mon Nov 13 21:58:35 PST 2017; root:xnu-3248.72.11~1/RELEASE_X86_64
- Cypress Version: 1.4.2
- Browser Version: Electron 53, Chrome 64
simonhaenisch, iwarin, ThaddeusJiang, bensampaio, kirkobyte and 31 moreMengtiSun, arkhamRejek, bondarewicz, sandra-ouadghiri, artemjackson and 1 more
Metadata
Metadata
Assignees
Labels
prevent-stalemark an issue so it is ignored by stale[bot]mark an issue so it is ignored by stale[bot]topic: fixturesFixture loading and usageFixture loading and usagetype: bugtype: featureNew feature that does not currently existNew feature that does not currently exist