How to import axios module into Alexa Node js Code in alexa skills. I am using alexa skills - alexa-skills-kit

How to import axios module into Alexa Node js Code within alexa skills. I am using alexa skills kit to develop a node js code. please help

If you use Alexa hosted, simply reference your module in your package.json
{
"name": "hello-world",
"version": "1.1.0",
"description": "alexa utility for quickly building skills",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Test",
"license": "ISC",
"dependencies": {
"ask-sdk": "^2.6.0",
"ask-sdk-core": "^2.6.0",
"ask-sdk-dynamodb-persistence-adapter": "^2.10.2",
"ask-sdk-model": "^1.18.0",
"aws-sdk": "2.637.0",
"axios": "^0.21.1",
"i18next": "^20.3.1",
"moment-timezone": "^0.5.33"
},
"devDependencies": {
"eslint": "^7.29.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-promise": "^5.1.0",
"prettier": "^2.3.1"
}
}
Then in your code, use it as usual
const axios = require("axios");
...
await axios...(...);
...

Related

"Error: Hook can only be invoked from render methods." error in Next.js and Preact

I am a beginner in Next.js. In Next.js and Preact based application, after downloading "node_modules" with "npm install --legacy-peer-deps" and running the project with "npm run dev", I am getting errors that I will add below. On the Homepage, I see the text "Internal Server Error".
I tried many versions of "Node.js" with "nvm" as a solution. When I worked on LTS and latest version the project never worked. When I run it on 16.x.x and below, the project works but errors occur.
I couldn't find the cause and solution for this. I hope someone knows the solution.
Errors:
Error: Hook can only be invoked from render methods.
at Object.n.options.__h (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\preact\debug\dist\debug.js:1:6026)
at l (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\preact\hooks\dist\hooks.js:1:175)
at Object.m (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\preact\hooks\dist\hooks.js:1:335)
at ReactDevOverlay (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\#next\react-dev-overlay\lib\internal\ReactDevOverlay.js:87:27)
at ReactDevOverlay (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\next\dist\server\dev\next-dev-server.js:71:12) at renderWithHooks (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5662:16)
at renderIndeterminateComponent (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5735:15)
at renderElement (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5950:7)
at renderNodeDestructiveImpl (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6108:11)
at renderNodeDestructive (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6080:14)
TypeError: Cannot read property 'context' of undefined
at Object.exports.useContext (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\preact\hooks\dist\hooks.js:1:2697)
at useRouter (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\next\dist\client\router.js:123:27)
at MyApp (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\.next\server\pages\_app.js:91:72)
at renderWithHooks (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5662:16)
at renderIndeterminateComponent (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5735:15)
at renderElement (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5950:7)
at renderNodeDestructiveImpl (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6108:11)
at renderNodeDestructive (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:6080:14)
at renderIndeterminateComponent (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5789:7)
at renderElement (C:\Users\muham\OneDrive\Masaüstü\WESTEROPS\neom-hotel-nextjs\node_modules\react-dom\cjs\react-dom-server-legacy.node.development.js:5950:7)
package.json
{
"name": "neom-hotel-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"export": "next build && next export",
"export-s3": "next build && next export '/*'",
"deploy": "next build && next export && firebase deploy",
"openid": "next build && next export && firebase hosting:channel:deploy openid",
"image": "next build && next export && firebase hosting:channel:deploy image",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"#fontsource/outfit": "^4.5.8",
"#steveeeie/react-page-transition": "^1.3.0",
"cupertino-pane": "^1.3.0",
"framer-motion": "^6.4.2",
"framework7-react": "^6.3.17",
"framework7": "^6.3.17",
"framework7-icons": "^4.0.2",
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-optipng": "^8.0.0",
"mapbox-gl": "^2.9.1",
"next": "^11.1.4",
"next-compose-plugins": "^2.2.1",
"next-optimized-images": "^2.6.2",
"next-plugin-preact": "^3.0.7",
"preact": "^10.8.2",
"preact-render-to-string": "^5.2.0",
"react": "npm:#preact/compat",
"react-bottom-sheet": "^1.1.1",
"react-dom": "npm:#preact/compat",
"react-modal-sheet": "^1.5.2",
"react-scroll-hooks": "^0.1.1",
"react-ssr-prepass": "npm:preact-ssr-prepass",
"react-transition-group": "^4.4.2",
"responsive-loader": "^3.0.4",
"sharp": "latest",
"styled-components": "^5.3.5",
"url-loader": "^4.1.1",
"webp-loader": "^0.6.0"
},
"devDependencies": {
"#zeit/next-css": "^1.0.1",
"eslint": "8.18.0",
"eslint-config-next": "12.2.0",
"next-purgecss": "^4.0.0"
}
}
package-lock.json
{
"name": "neom-hotel-nextjs",
"version": "0.1.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "neom-hotel-nextjs",
"version": "0.1.0",
"dependencies": {
"#fontsource/outfit": "^4.5.8",
"#steveeeie/react-page-transition": "^1.3.0",
"cupertino-pane": "^1.3.0",
"framer-motion": "^6.4.2",
"framework7": "^6.3.17",
"framework7-icons": "^4.0.2",
"framework7-react": "^6.3.17",
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-optipng": "^8.0.0",
"mapbox-gl": "^2.9.1",
"next": "^11.1.4",
"next-compose-plugins": "^2.2.1",
"next-optimized-images": "^2.6.2",
"next-plugin-preact": "^3.0.7",
"preact": "^10.8.2",
"preact-render-to-string": "^5.2.0",
"react": "npm:#preact/compat",
"react-bottom-sheet": "^1.1.1",
"react-dom": "npm:#preact/compat",
"react-modal-sheet": "^1.5.2",
"react-scroll-hooks": "^0.1.1",
"react-ssr-prepass": "npm:preact-ssr-prepass",
"react-transition-group": "^4.4.2",
"responsive-loader": "^3.0.4",
"sharp": "latest",
"styled-components": "^5.3.5",
"url-loader": "^4.1.1",
"webp-loader": "^0.6.0"
},
"devDependencies": {
"#zeit/next-css": "^1.0.1",
"eslint": "8.18.0",
"eslint-config-next": "12.2.0",
"next-purgecss": "^4.0.0"
}
},

Issues when generating NUXT build

I am building a nuxt ssr app and whenever I run build command, I get this error of css-loader related to Invalid options object.
ERROR in ./node_modules/vue2-google-maps/dist/components/streetViewPanorama.vue (./node_modules/#nuxt/webpack/node_modules/css-loader/dist/cjs.js?minimize!./node_modules/vue-loader/lib/style-compiler?{"optionsId":"0","vue":true,"scoped":false,"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./node_modules/vue2-google-maps/dist/components/streetViewPanorama.vue)
Module build failed (from ./node_modules/#nuxt/webpack/node_modules/css-loader/dist/cjs.js):
ValidationError: Invalid options object. CSS Loader has been initialized using an options object that does not match the API schema.
- options has an unknown property 'minimize'. These properties are valid:
object { url?, import?, modules?, icss?, sourceMap?, importLoaders?, esModule? }
at validate (D:\Dev\Vuejs\Nuxt\nuxt-app\node_modules\#nuxt\webpack\node_modules\css-loader\node_modules\schema-utils\dist\validate.js:98:11)
at Object.loader (D:\Dev\Vuejs\Nuxt\nuxt-app\node_modules\#nuxt\webpack\node_modules\css-loader\dist\index.js:36:28)
# ./node_modules/vue2-google-maps/dist/components/streetViewPanorama.vue (./node_modules/vue-style-loader!./node_modules/#nuxt/webpack/node_modules/css-loader/dist/cjs.js?minimize!./node_modules/vue-loader/lib/style-compiler?{"optionsId":"0","vue":true,"scoped":false,"sourceMap":false}!./node_modules/vue-loader/lib/selector.js?type=styles&index=0!./node_modules/vue2-google-maps/dist/components/streetViewPanorama.vue) 4:14-295
# ./node_modules/vue2-google-maps/dist/components/streetViewPanorama.vue
# ./node_modules/vue2-google-maps/dist/main.js
# ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./components/GoogleMap.vue
# ./components/GoogleMap.vue
# ./components/AddPost.vue
# ./components/Header.vue
# ./layouts/nossr.vue
# ./.nuxt/App.js
# ./.nuxt/index.js
# ./.nuxt/client.js
# multi ./node_modules/#nuxt/components/lib/installComponents.js ./.nuxt/client.js
I have install the css-loader as well but the issue persists. Below is my package.json
{
"name": "test",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate",
"deploy": "push-dir --dir=dist --branch=gh-pages --cleanup",
"test": "jest"
},
"dependencies": {
"#azure/storage-blob": "12.6.0",
"#capacitor-community/http": "1.0.0",
"#capacitor/android": "2.4.6",
"#capacitor/core": "2.4.6",
"#ffmpeg-installer/ffmpeg": "1.1.0",
"#fortawesome/fontawesome-svg-core": "1.2.28",
"#fortawesome/free-brands-svg-icons": "5.13.0",
"#fortawesome/free-solid-svg-icons": "5.13.0",
"#fortawesome/vue-fontawesome": "0.1.10",
"#mathieustan/vue-datepicker": "^0.2.11",
"#nuxtjs/axios": "^5.13.6",
"#nuxtjs/dotenv": "^1.4.1",
"#nuxtjs/svg": "^0.4.0",
"#vue-stripe/vue-stripe": "4.1.1",
"axios": "^0.24.0",
"azure-storage": "^2.10.4",
"capacitor-resources": "2.0.5",
"cordova-res": "0.15.3",
"core-js": "^3.15.1",
"cors": "2.8.5",
"cropperjs": "1.5.9",
"crypto-js": "4.0.0",
"css-loader": "5.0.0",
"debounce": "1.2.0",
"fluent-ffmpeg": "2.1.2",
"jquery": "1.9.1",
"lodash": "4.17.21",
"lru-cache": "6.0.0",
"luxon": "1.25.0",
"masonry-layout": "4.2.2",
"moment": "^2.9.0",
"moment-timezone": "^0.5.33",
"number-abbreviate": "^2.0.0",
"nuxt": "^2.15.7",
"photoswipe": "^5.2.4",
"postcss": "8.1.10",
"postcss-import": "13.0.0",
"postcss-loader": "4.1.0",
"postcss-url": "10.1.1",
"push-dir": "^0.4.1",
"rxjs": "6.6.3",
"simple-vue-validator": "0.16.0",
"style-loader": "^3.3.1",
"stylus-loader": "^6.2.0",
"underscore": "^1.13.1",
"v-datatable-light": "0.8.2",
"v-lazy-image": "1.4.0",
"video-metadata-thumbnails": "1.0.22",
"vue-datatables-net": "1.4.1",
"vue-datetime": "1.0.0-beta.13",
"vue-loader": "14.2.4",
"vue-meta": "2.4.0",
"vue-quill-editor": "3.0.6",
"vue-router": "3.3.4",
"vue-rx": "6.2.0",
"vue-scroll": "^2.1.13",
"vue-select": "^3.10.3",
"vue-svg-loader": "^0.16.0",
"vue-tables-2": "^2.3.1",
"vue-the-mask": "^0.11.1",
"vue-tippy": "^4.7.2",
"vue-toast-notification": "0.4.1",
"vue2-datepicker": "3.8.2",
"vue2-google-maps": "0.10.7",
"vue2-timepicker": "^1.1.6",
"vuejs-clipper": "3.0.3",
"vuejs-datepicker": "1.6.2",
"vuetable-2": "2.0.0-beta.4",
"vuex": "3.4.0",
"vuex-persistedstate": "3.0.1",
"weekstart": "1.0.1"
},
"devDependencies": {
"#capacitor/cli": "2.4.6",
"#vue/cli-plugin-babel": "~4.4.0",
"#vue/cli-service": "~4.4.0",
"#vue/test-utils": "^1.2.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.1.0",
"babel-jest": "^27.0.5",
"eslint": "6.7.2",
"jest": "^27.0.5",
"sass": "^1.50.1",
"sass-loader": "^10.2.1",
"source-map-loader": "^3.0.0",
"vue-jest": "^3.0.4",
"vue-masonry-css": "1.0.3"
},
"main": "index.js",
"license": "MIT"
}
I have searched alot but couldn't find any solution. kindly help me out. Thanks in advance!
This question is not really solvable without having the whole context and making an in-depth analysis of all the packages one by one: upgrading the legacy ones, removing the deprecated ones and figuring out what kind of specific configuration is in place (Stylus for example).
The given reproduction kinda shows the issue, but we cannot just solve them in package.json because it may break the logic that is based on those specific versions.
Since the project is private, there is no real way to help here without having more info.

Nextjs 10.0 builds without styles

Hello guys can anybody help with Nextjs v10 build ? it builds without styles :|
here is my package.json and next.config.js
I import all styles in _app.js, it also comes in chrome network -> preview without styles
On vercel everything is ok, but when i try to build on my computer, it's without styles :|
**
next.config.js
**
module.exports = {
images: {
domains: ['localhost','assets.vercel.com','via.placeholder.com','mine-front-new.vercel.app'],
},
}
package.json
{
"name": "mine",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "next",
"build": "next build",
"start": "next start",
"prod:build": "SET NODE_ENV=production && next build && next export",
"export": "next build && next export"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"#fortawesome/fontawesome-free": "^5.13.1",
"#material-ui/core": "^4.11.0",
"#material-ui/icons": "^4.9.1",
"#material-ui/lab": "^4.0.0-alpha.57",
"add": "^2.0.6",
"axios": "^0.19.2",
"chart.js": "^2.9.3",
"date-fns": "^2.16.1",
"draft-js": "^0.11.7",
"es6-shim": "^0.35.6",
"js-cookie": "^2.2.1",
"jwt-decode": "^3.0.0",
"moment": "^2.27.0",
"next": "10.0.0",
"react": "17.0.1",
"react-chartjs-2": "^2.9.0",
"react-dom": "17.0.1",
"react-facebook": "^8.1.4",
"react-lottie": "^1.2.3",
"react-transition-group": "^4.4.1",
"yarn": "^1.22.10"
},
"devDependencies": {
"#types/cookie": "^0.4.0",
"clsx": "^1.1.1",
"cookie": "^0.4.1",
"prop-types": "^15.7.2",
"react-date-range": "^1.0.3",
"react-reveal": "^1.2.2",
"react-slick": "^0.26.1",
"react-toastify": "^6.0.8",
"slick-carousel": "^1.8.1",
"sweetalert2": "^9.15.2"
}
}
Make sure u use appropriate css loaders. I faced the same issue and resolved using this,
loaders: ['style-loader', 'css-loader', 'less-loader']
My next.config.js
module.exports = withImages({
target: 'serverless',
webpack: function (config, { webpack }) {
config.module.rules.push({
test: /\.(eot|svg|gif|md)$/,
loaders: ['style-loader', 'css-loader', 'less-loader']
})
return config
},
})

Vue JS Build not Import CSS Files

My CSS code that I imported into my Vue project and runs in the "npm run serve" section does not work on my server after "npm run build". What could be the reason for this? When I open the index file in the dist file on the local computer, it says CSS is missing, it does not say any error on the server.
main.js
import Vue from 'vue'
import App from './App.vue'
import VRouter from './router'
import VStore from './configurations/storeConfiguration'
import V18n from './configurations/languageConfiguration'
// Special CSS Library ( UA )
import "./assets/scss/ua.css";
The CSS file that appears appears in the development environment. However, it does not appear in the server environment.
package.json
{
"name": "driver",
"version": "0.1.0",
"private": true,
"sideEffects": false,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^1.2.32",
"#fortawesome/free-solid-svg-icons": "^5.15.1",
"#fortawesome/vue-fontawesome": "^2.0.0",
"axios": "^0.20.0",
"bootstrap": "^4.5.3",
"bootstrap-vue": "^2.17.3",
"core-js": "^3.6.5",
"epic-spinners": "^1.1.0",
"node-sass": "^4.14.1",
"sass": "^1.27.0",
"sass-loader": "^10.0.3",
"scriptjs": "^2.5.9",
"sweet-modal-vue": "^2.0.0",
"v-mask": "^2.2.3",
"vue": "^2.6.12",
"vue-analytics": "^5.22.1",
"vue-ctk-date-time-picker": "^2.5.0",
"vue-i18n": "^8.22.0",
"vue-input-mask": "0.0.11",
"vue-router": "^3.4.7",
"vue-suggestion": "^1.1.0",
"vue-sweetalert2": "^4.0.0",
"vue-the-mask": "^0.11.1",
"vue-toastification": "^1.7.8",
"vuex": "^3.5.1"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
First things first:
npm run serve does not serve the content of your dist file
Check: How to run production site after build vue cli
Would you mind show some code so we can analyse your problem?

How to import modules for use in detox

Describe the bug
I'm struggling to import external packages to use with Detox test files. My specific use case is that a testID is linked to a unique key that I need to pull from a firebase database. I've looked through these threads documenting similar issues, but all the solutions that I've tried have not worked for me (the majority of the responses were from 2018/early 2019)
https://github.com/vuejs/vue-cli/issues/1584
https://github.com/facebook/jest/issues/6933
Is there a current consensus on the best way to import modules into a test.spec.js style e2e file so that Detox can use them in tests?
To Reproduce
[x] I have tested this issue on the latest Detox release and it still reproduces
Steps to reproduce:
1. add import database from '#react-native-firebase/database'; to the top of the test file
2. run npx react-native start &
3. run npx detox test -c ./e2e/test.spec.js
Configuration
babel.config.js:
module.exports = {
presets: [
[
'babel-preset-env',
{
targets: {
node: 'current'
}
}
]
]
};
package.json:
{
"name": <omitted>,
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "react-scripts jest",
"lint": "eslint .",
"preinstall": "node scripts/pre-install.js",
"appium": "appium",
"build:android": "scripts/build-android.sh",
"build:ios": "scripts/build-ios.sh",
"test:android": "appium-helper --platform android",
"test:ios": "appium-helper --platform ios",
"test:local-e2e": "OS=both scripts/run-local-tests.sh",
"run-emulator:android": "scripts/run-android-emulator.sh",
"kill-emulator:android": "scripts/kill-android-emulator.sh"
},
"dependencies": {
"#react-native-firebase/app": "^6.0.2",
"#react-native-firebase/auth": "^6.0.2",
"#react-native-firebase/database": "^6.0.2",
"babel-plugin-dynamic-import-node": "^2.3.0",
"detox": "15.1.3",
"geocodio-library-node": "^1.0.0",
"prettier": "^1.19.1",
"react": "16.12.0",
"react-native": "0.61.5",
"react-native-animatable": "^1.3.3",
"react-native-collapsible": "^1.5.1",
"react-native-gesture-handler": "^1.4.1",
"react-native-reanimated": "^1.7.0",
"react-native-screens": "^2.0.0-alpha.27",
"react-native-segmented-control-tab": "^3.4.1",
"react-native-testing-library": "^1.11.1",
"react-navigation": "^4.0.10",
"react-navigation-stack": "1.9.3"
},
"devDependencies": {
"#babel/core": "^7.8.3",
"#babel/runtime": "^7.8.3",
"#react-native-community/eslint-config": "^0.0.6",
"appium": "1.16.0",
"babel-jest": "^25.1.0",
"babel-preset-env": "1.7.0",
"babel-preset-react-native": "4.0.1",
"babel-preset-react-native-stage-0": "1.0.1",
"babel-preset-stage-0": "6.24.1",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.58.0",
"prop-types": "15.7.2",
"react-test-renderer": "16.12.0",
"tape-async": "2.3.0",
"tipsi-appium-helper": "3.3.0",
"webdriverio": "5.18.6"
},
"jest": {
"preset": "react-native",
"transformIgnorePatterns": [
"node_modules/(?!((jest-)?react-native|react-navigation|#react-navigation|#react-native-firebase.*))"
],
"transform": {
"^.+\\.js$": "babel-jest"
},
"setupFiles": [
"./node_modules/react-native-gesture-handler/jestSetup.js",
"react-native/jest/setup.js",
"./jest/setup.js"
]
},
"detox": {
"configurations": {...},
"test-runner": "jest"
}
}
Device and Verbose Detox Logs
● Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
Here's what you can do:
• To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
• If you need a custom transformation specify a "transform" option in your config.
• If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.
You'll find more details and examples of these config options in the docs:
https://jestjs.io/docs/en/configuration.html
Details:
.../node_modules/#react-native-firebase/database/lib/index.js:18
import { isBoolean, isNumber, isString } from '#react-native-firebase/app/lib/common';
^^^^^^
SyntaxError: Cannot use import statement outside a module
> 1 | import database from '#react-native-firebase/database';
Environment (please complete the following information):
- Detox: 15.1.3
- React Native: 0.61.5
- Node: 13.5.0
- Device: Dell XPS 13 2019
- OS: Arch Linux
- Test-runner: Jest+jasmine

Resources