Skip to content

Error: [BABEL] unknown: Preset #5808

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

Closed
zerocewl opened this issue Dec 16, 2020 · 9 comments
Closed

Error: [BABEL] unknown: Preset #5808

zerocewl opened this issue Dec 16, 2020 · 9 comments

Comments

@zerocewl
Copy link

zerocewl commented Dec 16, 2020

Updating testcafe from v 1.9.4 to v 1.10.0 throws an error before ELECTRON test execution starts.

testcafe electron:./app

Tested with 0.0.15 and new 0.0.16 testcafe-browser-provider-electron

ERROR Error: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,
`` `
babel.transform(code, { filename: 'file.ts', presets: [/* your preset */] });
`` `
See https://babeljs.io/docs/en/options#filename for more information.
    at validateIfOptionNeedsFilename (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:286:11)

Note: The tests work fine even with Testcafe 1.9.4 and testcafe-browser-provider-electron 0.0.16.

What is your Test Scenario?

Start some tests =)

What is the Current behavior?

Tests do not start.

What is the Expected behavior?

Tests should start.

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example):
Your complete test code (or attach your test files):
 
Your complete configuration file (if any):

Your complete test report:

Screenshots:

Steps to Reproduce:

  1. Update testcafe to v 1.10.0
  2. Start electron tests.

Your Environment details:

  • testcafe version: 1.10.0
  • node.js version: v12.18.2
  • command-line arguments: testcafe electron:./app
  • browser name and version: electron v 10.2.0
  • platform and version: Fedora33 (Linux 5.9.12-200.fc33.x86_64 )
  • other: Full stacktrace:
testcafe electron:./app
ERROR Error: [BABEL] unknown: Preset /* your preset */ requires a filename to be set when babel is called directly,
`` `
babel.transform(code, { filename: 'file.ts', presets: [/* your preset */] });
`` `
See https://babeljs.io/docs/en/options#filename for more information.
    at validateIfOptionNeedsFilename (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:286:11)
    at /home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:298:52
    at Array.forEach (<anonymous>)
    at validatePreset (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:298:25)
    at loadPresetDescriptor (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:305:3)
    at loadPresetDescriptor.next (<anonymous>)
    at recursePresetDescriptors (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:112:30)
    at recursePresetDescriptors.next (<anonymous>)
    at /home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:186:21
    at Generator.next (<anonymous>)
    at loadFullConfig (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/config/full.js:142:5)
    at loadFullConfig.next (<anonymous>)
    at Function.transform (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/transform.js:25:45)
    at transform.next (<anonymous>)
    at evaluateSync (/home/TestUser/projects/myProject/node_modules/gensync/index.js:244:28)
    at Function.sync (/home/TestUser/projects/myProject/node_modules/gensync/index.js:84:14)
    at Object.transform (/home/TestUser/projects/myProject/node_modules/@babel/core/lib/transform.js:36:54)
    at downgradeES (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/compile-client-function.js:36:28)
    at Object.compileClientFunction [as default] (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/compile-client-function.js:81:14)
    at ClientFunctionBuilder._getCompiledFnCode (/home/TestUser/projects/myProject/node_modules/testcafe/src/client-functions/client-function-builder.js:114:41)
    at new ClientFunctionBuilder (/home/TestUser/projects/myProject/node_modules/testcafe/src/client-functions/client-function-builder.js:30:36)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/client-functions/selectors/add-api.js:18:22)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/client-functions/selectors/selector-builder.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/test-run/commands/actions.js:2:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/api/test-controller/index.js:19:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/api/wrap-test-function.ts:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/api/structure/fixture.ts:6:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/test-file/api-based.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/test-file/formats/es-next/compiler.js:2:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/compilers.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/compiler/index.js:12:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/runner/bootstrapper.ts:14:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/home/TestUser/projects/myProject/node_modules/testcafe/src/runner/index.js:12:1)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Module._compile (/home/TestUser/projects/myProject/node_modules/source-map-support/source-map-support.js:547:25)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at lazy (/home/TestUser/projects/myProject/node_modules/import-lazy/index.js:2:51)
    at Object.construct (/home/TestUser/projects/myProject/node_modules/import-lazy/index.js:18:11)
    at TestCafe._createRunner (/home/TestUser/projects/myProject/node_modules/testcafe/src/testcafe.js:75:27)
    at TestCafe.createRunner (/home/TestUser/projects/myProject/node_modules/testcafe/src/testcafe.js:90:21)
    at runTests (/home/TestUser/projects/myProject/node_modules/testcafe/src/cli/cli.js:91:75)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at cli (/home/TestUser/projects/myProject/node_modules/testcafe/src/cli/cli.js:162:13)

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 16, 2020
@Farfurix
Copy link
Contributor

@zerocewl

Hello,

I tried to reproduce it and my tests passed without such errors. Could you please share a simple project that illustrates this issue?

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@Farfurix Farfurix added the STATE: Need clarification An issue lacks information for further research. label Dec 18, 2020
@zerocewl
Copy link
Author

zerocewl commented Dec 18, 2020

@Farfurix

Sure np. Just use my fork of the electron-react-boilerplate. It is based on the tag 1.4 of the template and i only updated testcafe@1.10.0.

To reproduce the mentioned error follow these steps:

@no-response no-response bot removed the STATE: Need clarification An issue lacks information for further research. label Dec 18, 2020
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@miherlosev
Copy link
Collaborator

Hi @zerocewl

Thank you for the example. I reproduced the issue. Stay tuned for our further updates.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@nonAlgebraic
Copy link

I'm experiencing the same error since 1.10.0. For me, it happens when @babel/preset-typescript is my Babel config file. Here's a minimal repro: https://github.com/nonAlgebraic/testcafe-babel-error-repro

  1. yarn instal
  2. yarn test
  3. error shows in console

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 18, 2020
@ericbiewener
Copy link

Just upgraded to 1.10.0 and am running into this error as well. I don't think it's related to a @babel/preset-typescript setting in my case, but our tests are written in TypeScript and we're using the tsConfigPath() method. Happy to provide more details if it would be helpful.

@miherlosev
Copy link
Collaborator

Folks,

Thank you for your examples. We reproduced the issue and are working on it. At the moment, we've got all the information we need.
We will release a new TestCafe version once we fix this issue.

@Thaval
Copy link

Thaval commented Dec 30, 2020

I got the exact same problem too with vue.js.
The configuration file looks like this

module.exports = {
    "env": {
        "development": {
            "sourceMaps": true,
            "retainLines": true,
        }
    },
    presets: [
        //'@vue/app'
    ],
}

As you can see, the line "@vue/app" is commented out so that testcafe works. Otherwise it will through the same exception that is given by the thread owner. However, the preset is required to be able to run the vue app.

It would be nice if the internals of testcafe would respect the preset or at least if we could specify a babel.config.js file to be used for testcafe (so that I could have a babel.config.js for the development/release and a babel.e2e.config.js for testcafe for example).

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Dec 30, 2020
@AlexKamaev
Copy link
Contributor

@Thaval
We fixed this issue. Your babel configuration file should not interfere with TestCafe after the fix. Please ensure that you are using TestCafe v1.10.1
If the issue persists and your version is 1.10.1, please share a sample that demonstrates the issue.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Dec 31, 2020
@Thaval
Copy link

Thaval commented Jan 1, 2021

I can confirm it's working now, got version 1.10.0 before. Thanks for the quick fix.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jan 1, 2021
@AlexSkorkin AlexSkorkin removed the STATE: Need response An issue that requires a response or attention from the team. label Jan 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants