Here is my package.json:
{
"name": "DFS",
"version": "1.0.0",
"description": "DFS App",
"author": "asd",
"private": true,
"nodemonConfig": {
"delay": "2500"
},
"scripts": {
"postinstall": "npm run build",
"dev": "node build/dev-server.js",
"start": "node build/dev-server.js",
"build": "node build/build.js",
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
"e2e": "node test/e2e/runner.js",
"test": "npm run unit && npm run e2e",
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
"deploy": "git subtree push --prefix dist heroku master"
},
"dependencies": {
"axios": "^0.16.2",
"connect-history-api-fallback": "^1.5.0",
"express-sslify": "^1.2.0",
"global": "^4.3.2",
"heroku-ssl-redirect": "0.0.4",
"less": "^3.0.1",
"less-loader": "^4.0.5",
"node-sass": "^4.7.2",
"npm-watch": "^0.3.0",
"sass-loader": "^6.0.6",
"style-loader": "^0.20.2",
"vee-validate": "^2.0.0-rc.14",
"vue": "^2.3.3",
"vue-router": "^2.3.1",
"vuetify": "^1.0.3",
"vuex": "^3.0.1",
"webpack-dev-server": "^3.0.0",
"webpack-watch": "^0.2.0"
},
"devDependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.22.1",
"babel-eslint": "^7.1.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-istanbul": "^4.1.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.5.0",
"babel-preset-env": "^1.3.2",
"babel-preset-stage-2": "^6.22.0",
"babel-register": "^6.22.0",
"chai": "^3.5.0",
"chalk": "^2.0.1",
"chromedriver": "^2.27.2",
"connect-history-api-fallback": "^1.3.0",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.1",
"cross-spawn": "^5.0.1",
"css-loader": "^0.28.0",
"cssnano": "^3.10.0",
"eslint": "^3.19.0",
"eslint-config-standard": "^6.2.1",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-html": "^3.1.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-standard": "^2.0.1",
"eslint-plugin-vue": "^4.0.0",
"eventsource-polyfill": "^0.9.6",
"express": "^4.14.1",
"extract-text-webpack-plugin": "^2.0.0",
"file-loader": "^0.11.1",
"friendly-errors-webpack-plugin": "^1.1.3",
"html-webpack-plugin": "^2.28.0",
"http-proxy-middleware": "^0.17.3",
"inject-loader": "^3.0.0",
"karma": "^1.4.1",
"karma-coverage": "^1.1.1",
"karma-mocha": "^1.3.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"karma-sinon-chai": "^1.3.1",
"karma-sourcemap-loader": "^0.3.7",
"karma-spec-reporter": "0.0.31",
"karma-webpack": "^2.0.2",
"lolex": "^2.0.0",
"mocha": "^3.2.0",
"nightwatch": "^0.9.12",
"node-notifier": "^5.1.2",
"opn": "^5.1.0",
"optimize-css-assets-webpack-plugin": "^2.0.0",
"ora": "^1.2.0",
"phantomjs-prebuilt": "^2.1.15",
"portfinder": "^1.0.13",
"postcss-import": "^11.0.0",
"postcss-loader": "^2.0.8",
"postcss-url": "^7.2.1",
"rimraf": "^2.6.0",
"selenium-server": "^3.0.1",
"semver": "^5.3.0",
"shelljs": "^0.7.6",
"sinon": "^2.1.0",
"sinon-chai": "^2.8.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"sw-precache-webpack-plugin": "^0.11.4",
"ts-loader": "^3.5.0",
"uglify-es": "^3.0.25",
"url-loader": "^0.5.8",
"vue-loader": "^12.1.0",
"vue-style-loader": "^3.0.1",
"vue-template-compiler": "^2.3.3",
"webpack": "^2.6.1",
"webpack-bundle-analyzer": "^2.2.1",
"webpack-cli": "^2.0.9",
"webpack-dev-middleware": "^1.10.0",
"webpack-hot-middleware": "^2.18.0",
"webpack-merge": "^4.1.0"
},
"engines": {
"node": ">= 4.0.0",
"npm": ">= 3.0.0"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
My main.js:
import Vue from 'vue'
import Vuetify from 'vuetify' // eslint-disable-line no-unused-vars
// import App from './App'
// import router from './router'
Vue.use(Vuetify)
// Vue.config.productionTip = false
new Vue({ // eslint-disable-line no-new
el: '#app',
// router,
template: '<div>hi there</div>'
// components: { App },
// template: '<App/>'
})
My App.vue
<template>
<div>
123
</div>
</template>
<script>
export default {
name: 'App'
}
</script>
I am using Heroku for the app hosting. When I try to visit site with desktop browser all is okay, but when I try to load it via mobile browser it shows the blank page.
For the other hand deploying this repo: https://github.com/deepak-singh/vue-blog-pwa
is successfully done and loading via mobile or desktop browser is successful.
Also I found that this line causes blank page in my vue app:
Vue.use(Vuetify)
But! This line is present in vue-pwa-blog repo file. So I can not understand what may I doing wrong?
This is happening because when a PWA is installed and opened on a phone it rewrites the URL to /index.html whereas the vuetify app is rendered at /.
Just re-adjust your vue-router to load the component at /index.html too and it should work.
Your router.js could look something like this:
{
path: '/',
name: 'App',
component: App
},
{
path: '/index.html',
name: 'App',
component: App
}
My routers are like this:
import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '#/components/HelloWorld'
Vue.use(Router)
export default new Router({
routes: [
{
path: '/',
name: 'HelloWorld',
component: HelloWorld
},
{
path: '/index.html',
name: 'HelloWorld',
component: HelloWorld
}
]
})
Still blank page.. If i remove my Vue.use(Vuetify) from main.js works..
Package.json ->
"dependencies": {
"vue": "^2.5.2",
"vue-router": "^3.0.1",
"vuetify": "^1.1.6"
},
Related
I have reset the metro but the same problem is happening. How can I solve this problem? The same problem is happening when I changed the port. I was facing the same problem when I rebuilt the project.
{
"name": "meal",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.11",
"#react-native-firebase/app": "^12.4.0",
"#react-native-firebase/database": "^12.4.0",
"#react-native-firebase/firestore": "^12.4.0",
"#react-native-firebase/messaging": "^12.4.0",
"#react-native-firebase/storage": "^12.4.0",
"#react-native-picker/picker": "^1.16.3",
"#react-navigation/bottom-tabs": "^5.11.11",
"#react-navigation/drawer": "^5.12.5",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.5",
"#reduxjs/toolkit": "^1.6.0",
"add": "^2.0.6",
"babel-preset-react-native": "^5.0.2",
"firebase-admin": "^9.11.0",
"lottie-react-native": "^4.0.2",
"moment": "^2.29.1",
"react": "17.0.1",
"react-dom": "^17.0.2",
"react-icons": "^4.2.0",
"react-is": "^17.0.2",
"react-native": "0.64.1",
"react-native-animated-loader": "^0.0.9",
"react-native-chart-kit": "^6.11.0",
"react-native-checkbox-selection": "^1.1.0",
"react-native-date-picker": "^3.3.2",
"react-native-dropdown-picker": "^5.1.21",
"react-native-elements": "^3.4.1",
"react-native-gesture-handler": "^1.10.3",
"react-native-image-picker": "^4.0.3",
"react-native-navigation-bar-color": "^2.0.1",
"react-native-picker-select": "^8.0.4",
"react-native-push-notification": "^7.4.0",
"react-native-reanimated": "^2.0.0",
"react-native-router-flux": "^3.45.0",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "^3.3.0",
"react-native-splash-screen": "^3.2.0",
"react-native-svg": "^12.1.1",
"react-native-vector-icons": "^8.1.0",
"react-redux": "^7.2.4",
"yarn": "^1.22.11"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/highlight": "^7.14.5",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "7.14.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.64.0",
"react-test-renderer": "17.0.1"
},
"jest": {
"preset": "react-native"
}
}
Delete the node_modules and package-lock.json. Install everything fresh and it should work.
My application perfectly running and building on localhost. But when it's building on Heroku, I'm getting the following error:
./src/index.js
Error: Cannot find module '#babel/plugin-proposal-decorators' from '/app'
at Array.map (<anonymous>)
That's my package.json:
{
"name": "agroproject-ui",
"version": "0.1.0",
"private": true,
"dependencies": {
"#ckeditor/ckeditor5-build-classic": "^12.0.0",
"#ckeditor/ckeditor5-react": "^1.1.1",
"#fortawesome/fontawesome-svg-core": "^1.2.8",
"#fortawesome/free-solid-svg-icons": "^5.5.0",
"#fortawesome/react-fontawesome": "^0.1.3",
"#pluralsight/ps-design-system-actionmenu": "^3.1.10",
"#pluralsight/ps-design-system-badge": "^2.1.12",
"#pluralsight/ps-design-system-button": "^10.8.15",
"#pluralsight/ps-design-system-card": "^8.5.8",
"#pluralsight/ps-design-system-dropdown": "^0.5.3",
"#pluralsight/ps-design-system-layout": "^3.0.2",
"#pluralsight/ps-design-system-normalize": "^3.0.45",
"#pluralsight/ps-design-system-row": "^2.6.25",
"#pluralsight/ps-design-system-textinput": "^0.5.6",
"#svgr/webpack": "2.4.1",
"#tinymce/tinymce-react": "^3.0.1",
"axios": "^0.18.0",
"babel-eslint": "9.0.0",
"babel-jest": "23.6.0",
"babel-loader": "8.0.4",
"babel-plugin-named-asset-import": "^0.2.2",
"babel-preset-react-app": "^5.0.4",
"bfj": "6.1.1",
"case-sensitive-paths-webpack-plugin": "2.1.2",
"chalk": "2.4.1",
"css-loader": "1.0.0",
"dotenv": "6.0.0",
"dotenv-expand": "4.2.0",
"eslint": "5.6.0",
"eslint-config-react-app": "^3.0.4",
"eslint-loader": "2.1.1",
"eslint-plugin-flowtype": "2.50.1",
"eslint-plugin-import": "2.14.0",
"eslint-plugin-jsx-a11y": "6.1.2",
"eslint-plugin-react": "7.11.1",
"file-loader": "2.0.0",
"fs-extra": "7.0.0",
"glamor": "^2.20.40",
"google-maps-react": "^2.0.2",
"html-webpack-plugin": "4.0.0-alpha.2",
"identity-obj-proxy": "3.0.0",
"jest": "23.6.0",
"jest-pnp-resolver": "1.0.1",
"jest-resolve": "23.6.0",
"jsonwebtoken": "^8.4.0",
"mini-css-extract-plugin": "0.4.3",
"node-sass": "^4.9.4",
"optimize-css-assets-webpack-plugin": "5.0.1",
"pnp-webpack-plugin": "1.1.0",
"postcss-cssnext": "^3.1.0",
"postcss-flexbugs-fixes": "4.1.0",
"postcss-import": "^12.0.0",
"postcss-loader": "3.0.0",
"postcss-preset-env": "6.0.6",
"postcss-safe-parser": "4.0.1",
"prop-types": "^15.6.2",
"react": "^16.5.2",
"react-app-polyfill": "^0.1.3",
"react-aux": "^1.1.0",
"react-dev-utils": "^6.0.5",
"react-dom": "^16.5.2",
"react-redux": "^6.0.0",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"react-table": "^6.8.6",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"resolve": "1.8.1",
"sass-loader": "7.1.0",
"style-loader": "0.23.0",
"terser-webpack-plugin": "1.1.0",
"url-loader": "1.1.1",
"webpack": "4.19.1",
"webpack-dev-server": "^3.2.1",
"webpack-manifest-plugin": "2.0.4",
"workbox-webpack-plugin": "3.6.2"
},
"scripts": {
"start": "node scripts/start.js",
"build": "node scripts/build.js",
"test": "node scripts/test.js"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx}"
],
"resolver": "jest-pnp-resolver",
"setupFiles": [
"react-app-polyfill/jsdom"
],
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx}",
"<rootDir>/src/**/?(*.)(spec|test).{js,jsx}"
],
"testEnvironment": "jsdom",
"testURL": "http://localhost",
"transform": {
"^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
"^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
},
"transformIgnorePatterns": [
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$",
"^.+\\.module\\.(css|sass|scss)$"
],
"moduleNameMapper": {
"^react-native$": "react-native-web",
"^.+\\.module\\.(css|sass|scss)$": "identity-obj-proxy"
},
"moduleFileExtensions": [
"web.js",
"js",
"json",
"web.jsx",
"jsx",
"node"
]
},
"babel": {
"presets": [
"react-app"
]
},
"devDependencies": {
"#babel/core": "^7.4.3",
"#babel/plugin-proposal-class-properties": "^7.4.0",
"#babel/plugin-proposal-decorators": "^7.4.0",
"#babel/preset-env": "^7.1.6",
"redux-devtools": "^3.4.2",
"redux-devtools-extension": "^2.13.7",
"stylelint-config-airbnb": "0.0.0"
}
Any idea what could possibly is wrong with package.json?
You have included #babel/plugin-proposal-decorators in your devDependencies.
By default, Heroku installs your dependencies and devDependencies, builds your slug, and then strips out your devDependencies. This makes sense: in most cases devDependencies shouldn't be on production; that's for things like testing frameworks, editor plugins, etc. that you need in development but not in production.
I recommend moving this module to your dependencies, though an alternative solution would be to tell Heroku not to prune your devDependencies by setting NPM_CONFIG_PRODUCTION=false or YARN_PRODUCTION=false, depending on the tool you're using.
Both approaches will require a redeploy to take effect, and unless you have a clear reason to use devDependencies on Heroku I urge you to use the former.
After migrating from Angular 5 to Angular 6 all my Material component do not work anymore - again... ...yet this time I am really clueless about what could cause the problem anymore. I invested half a day investigating and created a stripped-down project in order to reproduce the problem in its essence.
Let me show you the various file contents:
package.json
{
"name": "xxx",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"#angular/animations": "^6.0.9",
"#angular/cdk": "^6.4.0",
"#angular/common": "^6.0.9",
"#angular/compiler": "^6.0.9",
"#angular/core": "^6.0.9",
"#angular/forms": "^6.0.9",
"#angular/http": "^6.0.9",
"#angular/material": "^6.4.0",
"#angular/platform-browser": "^6.0.9",
"#angular/platform-browser-dynamic": "^6.0.9",
"#angular/platform-server": "^6.0.9",
"#angular/router": "^6.0.9",
"#ngtools/webpack": "1.8.0",
"#types/node": "~6.0.60",
"#types/webpack-env": "1.13.0",
"angular2-template-loader": "0.6.2",
"aspnet-prerendering": "^3.0.1",
"aspnet-webpack": "^2.0.1",
"awesome-typescript-loader": "3.2.1",
"codelyzer": "~3.2.0",
"css": "2.2.1",
"css-loader": "0.28.4",
"es6-shim": "0.35.3",
"event-source-polyfill": "0.0.9",
"expose-loader": "0.7.3",
"extract-text-webpack-plugin": "2.1.2",
"file-loader": "0.11.2",
"html-loader": "0.4.5",
"isomorphic-fetch": "2.2.1",
"jquery": "3.2.1",
"json-loader": "0.5.4",
"preboot": "4.5.2",
"protractor": "~5.1.2",
"raw-loader": "0.5.1",
"reflect-metadata": "0.1.10",
"rxjs": "^6.2.2",
"style-loader": "0.18.2",
"to-string-loader": "1.1.5",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.7.2",
"url-loader": "0.5.9",
"webpack": "2.5.1",
"webpack-hot-middleware": "2.18.2",
"webpack-merge": "4.1.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"#angular/cli": "^6.0.8",
"#angular/compiler-cli": "^6.0.9",
"#angular/language-service": "^6.0.9",
"#types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0"
}
}
app.module
import { NgModule } from '#angular/core';
import { MatDialogModule } from '#angular/material';
import { CommonModule } from '#angular/common';
import { RouterModule } from '#angular/router';
import { AppComponent } from './components/app/app.component';
import { MessageFormComponent } from './components/common/forms/message.component';
#NgModule({
declarations: [
AppComponent,
MessageFormComponent,
],
imports: [
CommonModule,
MatDialogModule,
RouterModule.forRoot([
{ path: '', redirectTo: 'home', pathMatch: 'full' },
{ path: 'home', component: MessageFormComponent },
{ path: '**', redirectTo: 'home' }
]),
]
})
export class AppModuleShared {
}
message.component.ts
import { Component } from '#angular/core';
import { MatDialog, MAT_DIALOG_DATA } from '#angular/material';
#Component({
selector: 'message-form',
template: 'blubb',
})
export class MessageFormComponent {
constructor(private alert: MatDialog) { } // this line causes the problem
}
As soon as I make ANYTHING with the material - this error occurs. I am good in programming angular programs - not so good in fiddling around with the NEVER WORKING infrastructure... ;-)
My build is working in Chrome, Safari, and Opera but breaking in Firefox.
I'm using React, Webpack, and Sass.
The console error I get is:
TypeError: wrappedCompareFn is not a function bundle.js:39813:24
and
TypeError: node is null bundle.js:7865:1
Below I've included my webpack file and the dependencies in my package.json. Any help we be greatly appreciated.
Webpack:
const path = require('path');
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const autoprefixer = require('autoprefixer');
module.exports = {
context: __dirname,
debug: true,
devtool: 'cheap-module-source-map',
entry: './client/src/App.jsx',
output: {
path: path.join(__dirname, './client/public'),
filename: 'bundle.js',
},
resolve: {
extensions: ['', '.js', '.jsx', '.json'],
},
externals: {
},
stats: {
colors: true,
reasons: true,
chunks: false,
},
plugins: [
new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/),
// new BundleAnalyzerPlugin(),
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
}),
],
module: {
preLoaders: [
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node-modules/,
},
],
noParse: [
/plotly\.js/,
],
loaders: [
{
test: /\.styl$/,
loader: 'style-loader!css-loader!stylus-loader',
},
{
test: /\.scss$/,
loader: 'style-loader!css-loader!postcss-loader!sass-loader',
},
{
test: /\.jsx?$/,
loader: 'babel-loader',
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.(jpe?g|png|gif|svg|ico|ttf)$/i,
loader: 'file-loader',
},
],
},
postcss: [autoprefixer({ browsers: ['last 2 versions'] })],
watch: false,
};
package.json dependencies:
"dependencies": {
"bluebird": "^3.4.6",
"classnames": "^2.2.5",
"connect-history-api-fallback": "^1.3.0",
"dotenv": "^2.0.0",
"express": "^4.14.0",
"http-status-codes": "^1.0.6",
"koa": "^1.2.4",
"koa-add-trailing-slashes": "^1.1.0",
"koa-basic-auth": "^1.1.2",
"koa-jwt": "^1.2.0",
"koa-mount": "^1.3.0",
"koa-route": "^2.4.2",
"koa-static": "^2.0.0",
"material-ui": "^0.16.2",
"materialize-css": "^0.97.8",
"moment": "^2.15.2",
"pm2": "^2.1.6",
"react": "^15.4.0",
"react-dom": "^15.4.0",
"react-materialize": "^0.17.0",
"react-redux": "^4.4.5",
"react-router": "^3.0.0",
"react-tap-event-plugin": "^2.0.0",
"react-tooltip": "^3.2.2",
"redux": "^3.6.0"
},
"devDependencies": {
"autofixture": "^0.1.2",
"autoprefixer": "^6.5.4",
"babel-core": "^6.18.0",
"babel-eslint": "^6.1.2",
"babel-jest": "^16.0.0",
"babel-loader": "^6.2.7",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-es2015": "^6.18.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"babel-register": "^6.18.0",
"bluebird": "^3.4.6",
"chai": "^3.5.0",
"child_process": "^1.0.2",
"co-supertest": "0.0.10",
"concurrently": "^3.1.0",
"css-loader": "^0.25.0",
"enzyme": "^2.5.1",
"eslint": "^3.9.1",
"eslint-config-airbnb": "^12.0.0",
"eslint-plugin-import": "^2.0.1",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.4.1",
"file-loader": "^0.9.0",
"gulp": "^3.9.1",
"gulp-batch": "^1.0.5",
"gulp-debug": "^2.1.2",
"gulp-eslint": "^3.0.1",
"gulp-exit": "0.0.2",
"gulp-jest": "^0.6.0",
"gulp-mocha": "^3.0.1",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-run": "^1.7.1",
"gulp-tap": "^0.1.3",
"gulp-testcafe": "^0.9.0",
"gulp-watch": "^4.3.11",
"gulp-webserver": "^0.9.1",
"jest": "^16.0.2",
"jquery": "^3.1.1",
"json-loader": "^0.5.4",
"live-server": "^1.1.0",
"lodash": "^4.16.6",
"materialize-css": "^0.97.8",
"mocha": "^3.1.2",
"node-materialize": "^1.1.1",
"node-sass": "^3.11.2",
"postcss-loader": "^1.2.1",
"react-addons-test-utils": "^15.4.0",
"react-test-renderer": "^15.4.0",
"request-promise": "^4.1.1",
"require-dir": "^0.3.1",
"sass": "^0.5.0",
"sass-loader": "^4.0.2",
"sass-rem": "^1.2.3",
"sinon": "^1.17.6",
"style-loader": "^0.13.1",
"stylus": "^0.54.5",
"stylus-loader": "^2.3.1",
"supertest": "^2.0.1",
"supertest-koa-agent": "^0.3.0",
"testcafe": "^0.9.0",
"webpack": "^1.13.3",
"webpack-bundle-analyzer": "^2.1.1",
"webpack-dev-server": "^1.16.2"
},
"jest": {
"moduleFileExtensions": [
"js",
"jsx"
],
"moduleNameMapper": {
"^.+\\.(css|styl|scss)$": "<rootDir>/test/mocks/styleMock.js",
"^.+\\.(gif|ttf|eot|svg)$": "<rootDir>/test/mocks/fileMock.js"
},
"moduleDirectories": [
"node_modules"
],
"scriptPreprocessor": "<rootDir>/node_modules/babel-jest",
"testPathDirs": [
"test/ui"
],
"testRegex": ".*-tests\\.(js|jsx)$"
}
}
Link to post possible duplicated from
I am testing my react/redux code with Mocha and expect, I got mocha configured to use es6 , but it seems to lack support for the array.prototype.includes even when I have a .babelrc specifying stage-0. And in my non-test code, array.prototype.includes works. Are there some settings aside from babelrc specific to mocha that need to be set in order to use array.prototype.includes?
Here is my package.json
{
"name": "client",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "mocha --compilers js:babel-core/register --recursive",
"test:watch": "npm test -- --watch",
"start": "node server.js"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-polyfill": "^6.3.14",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"expect": "^1.14.0",
"lodash": "^4.0.1",
"mocha": "^2.4.5",
"react-addons-test-utils": "^0.14.7",
"react-hot-loader": "^1.3.0",
"redux-devtools": "^3.0.2",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.2",
"webpack": "^1.12.11",
"webpack-dev-server": "^1.14.1"
},
"dependencies": {
"axios": "^0.8.1",
"cuid": "^1.3.8",
"history": "^1.17.0",
"lodash": "^4.0.1",
"ramda": "^0.19.1",
"react": "^0.14.6",
"react-addons-shallow-compare": "^0.14.7",
"react-dom": "^0.14.6",
"react-redux": "^4.0.6",
"react-router": "^1.0.3",
"react-router-redux": "^2.1.0",
"redux": "^3.1.7",
"redux-crud": "^0.10.1",
"redux-devtools": "^3.0.2",
"redux-devtools-dock-monitor": "^1.0.1",
"redux-devtools-log-monitor": "^1.0.2",
"redux-loop": "^1.0.2",
"redux-saga": "^0.4.1",
"redux-simple-router": "^2.0.3",
"reselect": "^2.0.3",
"seamless-immutable": "^5.0.1"
}
}
Thank you!
Array.prototype.includes is provided via babel-polyfill since it does not require transpiling. It looks like you already have babel-polyfill in your package.json so just make sure you are importing it in your mocha tests.