Error when running ios-basic-interactions.test.js
See original GitHub issueThe problem
I am trying to run the ios-basic-interactions.test.js but an error is thrown immediately after I try to run the test.
Environment
- Appium version (or git revision) that exhibits the issue: 1.16.0
- Desktop OS/version used to run Appium: macOS 10.14.6
- Node.js version (unless using Appium.app|exe): 13.6.0
- Mobile platform/version under test: iOS 13
- Real device or emulator/simulator: Simulator
- Appium CLI or Appium.app|exe: CLI
Code To Reproduce Issue [ Good To Have ]
$ appium & node ios-basic-interactions.test.js
[1] 32187
(node:32188) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
/Users/me/app/ios-basic-interactions.test.js:1
import wd from 'wd';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1060:16)
at Module._compile (internal/modules/cjs/loader.js:1108:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
at Module.load (internal/modules/cjs/loader.js:993:32)
at Function.Module._load (internal/modules/cjs/loader.js:892:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
me:~/app $ [Appium] Welcome to Appium v1.16.0
[Appium] Appium REST http interface listener started on 0.0.0.0:4723
Issue Analytics
- State:
- Created 4 years ago
- Comments:9
Top Results From Across the Web
Dealing With Problems With Running Tests | Detox
This page is about issues related to executing your Detox tests, typically triggered when running detox test (and not detox build, for example)....
Read more >Unit test not working on Xcode 14 RC
In my case setting Host Application in the test target settings > General > Testing from "None" to the main app solved this...
Read more >NotAllowedError: play() failed because the user didn't ...
The main problem problem with this was that it was really difficult to find out in which component or service this error was...
Read more >Handling common JavaScript problems - MDN Web Docs
Familiarity with the core HTML, CSS, and JavaScript languages; an idea of the high-level principles of cross browser testing. Objective: To be ...
Read more >iOS Unit Testing and UI Testing Tutorial
Generally, tests should cover: Core functionality: Model classes and methods and their interactions with the controller; The most common UI ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Responding to my own comment, I may have been running the command from the wrong directory.
After running
npm test
in thesample-code
directory, and then changing to thejavascript-wd
and re-running the command:javascript-wd|master ⇒ $(npm bin)/mocha test/basic/ios-basic-interactions.test.js
I no longer got the previous error. I got another error, but it’s probably unrelated.
Ok, I’m facing the same here, maybe there still something wrong or misconfigration:
It’s wired the complain of “SyntaxError: Cannot use import statement outside a module”.
Maybe it releated to babel ?