This is the part in my gulpfile:
gulp.task('compile-js', function () {
// app.js is your main JS file with all your module inclusions
return browserify({
extensions: ['.js', '.jsx'],
entries: 'javascripts/app.js',
debug: true
})
.transform('babelify', { presets: ['es2015', 'react'] })
.bundle()
.pipe(source('bundle.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write('./maps'))
.pipe(gulp.dest('dist'))
.pipe(livereload())
})
in my javascripts/app.js:
I have, for an example:
async function write () {
var txt = await read();
console.log(txt);
}
I get this error:
GulpUglifyError: unable to minify JavaScript
This is part of my package.json:
"dependencies": {
"animate.css": "^3.5.2",
"aos": "^2.2.0",
"autosize": "^4.0.0",
"axios": "^0.16.2",
"es6-docready": "^1.0.0",
"foundation-icon-fonts": "^0.1.1",
"foundation-sites": "^6.4.3",
"gulp-clean-css": "^3.9.0",
"gulp-cssimport": "^5.1.1",
"jquery": "^3.1.1",
"jquery-ui-bundle": "^1.12.1",
"material-design-icons": "^3.0.1",
"swiper": "^3.4.2",
"vue": "^2.4.4"
},
"repository": {
"type": "git",
"url": "[git-url-of-your-project]"
},
"devDependencies": {
"babel-preset-es2015": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babelify": "^7.3.0",
"browserify": "^14.3.0",
"browserify-shim": "^3.8.12",
"gulp": "^3.9.1",
"gulp-clean-css": "^3.0.4",
"gulp-clone": "^1.0.0",
"gulp-concat": "^2.6.0",
"gulp-concat-css": "^2.3.0",
"gulp-cssimport": "^5.0.0",
"gulp-foreach": "^0.1.0",
"gulp-htmlmin": "^3.0.0",
"gulp-less": "^3.3.2",
"gulp-livereload": "^3.8.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^2.1.2",
"streamqueue": "^1.1.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0"
},
What else should I add to my gulp process for ES6?
EDIT:
so following the babel doc for es2017:
I have installed:
npm install --save-dev babel-preset-es2017
And changed my gulpfile:
...
.transform('babelify', {
presets: ['es2015', 'es2017', 'react'],
I don't get any error during the compilation, but I get this error on the browser console when I run my code on my browser:
Uncaught ReferenceError: regeneratorRuntime is not defined
Had similar issue with gulp-uglify, and as I've found out it seems that minifying async/await is not supported with base gulp-uglify, so I switched to babel-minify, and it worked for me.
EDIT: For regeneratorRuntime is not defined error, I think that regenerator-runtime could be helpful.
I've solved the problem replacing:
.pipe(uglify()) by .pipe(minify())
https://www.npmjs.com/package/gulp-minify
Related
I'm trying to update an old repository that is using Gulp 3.9.1 + browserify 11.2.0 to Gulp 4.0.2 + browserify 17.0.0. But those are not the only packages I'm using in this project.
This is the old package.json and the old code I'm trying to port to the new version:
package.json:
"devDependencies": {
"babel": "^5.8.29",
"babel-cli": "^6.22.2",
"babel-preset-es2015": "^6.22.0",
"babelify": "^6.4.0",
"browserify": "^11.2.0",
"core-js": "^1.2.3",
"extend": "^3.0.0",
"fs": "0.0.2",
"glslify": "^2.3.1",
"gsap": "^1.18.0",
"gulp": "^3.9.1",
"gulp-babel": "^5.2.1",
"gulp-connect": "^2.2.0",
"gulp-imagemin": "^3.1.1",
"gulp-newer": "^1.3.0",
"gulp-streamify": "^1.0.2",
"gulp-uglify": "^1.5.3",
"uglify-js": "^2.5.0",
"vinyl-source-stream": "^1.1.0"
}
Code:
const gulp = require('gulp')
const source = require('vinyl-source-stream')
const browserify = require('browserify')
const uglify = require('gulp-uglify')
const streamify = require('gulp-streamify')
const babelify = require("babelify");
gulp.task('build', function(){
build();
});
function build() {
browserify('src/index.js', {debug: true})
.transform(babelify)
.transform('glslify')
.bundle()
.on('error', function (err) {
console.log('Error : ' + err.message);
})
.pipe(source('index.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('public/js'));
}
The new package.json and the code I have until now, that I'm not sure if it is the correct implementation:
package.json:
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.18.0",
"babel-preset-env": "^1.7.0",
"browserify": "^17.0.0",
"core-js": "^1.2.3",
"extend": "^3.0.0",
"fs": "0.0.2",
"glslify": "^7.1.1",
"gsap": "^3.6.1",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-connect": "^2.2.0",
"gulp-imagemin": "^7.1.0",
"gulp-map": "^0.0.2",
"gulp-newer": "^1.3.0",
"gulp-streamify": "^1.0.2",
"gulp-uglify": "^1.5.3",
"uglify-js": "^2.5.0",
"vinyl": "^0.5.3",
"vinyl-source-stream": "^1.1.0"
}
Code:
const gulp = require('gulp');
const browserify = require('browserify');
const babel = require('gulp-babel');
const glslify = require('glslify')
const source = require('vinyl-source-stream');
const streamify = require('gulp-streamify');
const uglify = require('gulp-uglify');
const map = require('gulp-map');
const Vinyl = require('vinyl');
gulp.task(build)
function build() {
gulp.src(['./src/**/*.js', './src/**/*.jsx'])
.pipe(browserify()
.transform(babel({options: 'env'}))
//.transform(glslify('./src/shaders/simple.vert')) // Not working
//.transform(glslify('./src/shaders/water.frag')) // Not working
.bundle().on('error', onError))
.pipe(source('index.min.js'))
.pipe(streamify(uglify()))
.pipe(map(function(file) {
// Explicitly convert to Vinyl object otherwise `gulp.dest()` will fail
return new Vinyl(file); // But it stills failing
}))
.pipe(gulp.dest('./public/js/'));
}
function onError(err) {
console.log('Error : ' + err.message);
}
I'm not sure if that is the correct way to migrate that code. I'm getting several issues from the different browserify modules, for example:
babel: that it seems to be fixed by changing from babelify to gulp-bable
glslify: that it seems to be deprecated, but I don't know which is the replace library
Also, and sorry for being repetitive, as I don't know how the migration should be, I'm getting this error after running the build command (gulp build):
[14:08:34] Using gulpfile ~/Documents/workspace/project/gulpfile.js
[14:08:34] Starting 'build'...
[14:08:34] 'build' errored after 109 ms
[14:08:34] TypeError: dest.write is not a function
at DestroyableTransform.ondata (/Users/user/Documents/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:619:20)
at DestroyableTransform.emit (node:events:379:20)
at DestroyableTransform.EventEmitter.emit (node:domain:532:15)
at addChunk (/Users/user/Documents/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:291:12)
at readableAddChunk (/Users/user/Documents/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:278:11)
at DestroyableTransform.Readable.push (/Users/user/Documents/workspace/project/node_modules/readable-stream/lib/_stream_readable.js:245:10)
at DestroyableTransform.Transform.push (/Users/user/Documents/workspace/project/node_modules/readable-stream/lib/_stream_transform.js:148:32)
at Pumpify.onReadable (/Users/user/Documents/workspace/project/node_modules/to-through/index.js:25:14)
at Pumpify.emit (node:events:379:20)
at Pumpify.EventEmitter.emit (node:domain:532:15)
Sorry for the long explanation, hope someone can help me.
After a lot of researching, I found this blog which has the answer, or almost it has the links to the answer.
One of the links took me to the most detailed tutorial about Gulp + Browserify + Babelify it could ever exist. Here the link. These are a serie of tutorial explaining how to implement Gulp from Scratch. If you don't want to see the videos and just want the code go here.
This is my final gulpfile.js.
And this is the answer to my question:
My formerly build function in gulpfile.js (now called js)
function js(done) {
jsFiles.map( function( entry ) {
return browserify({
entries: [constants.jsSRC + entry] // constants.jsSRC == "./src/js/"
})
.transform( babelify, { presets: [ '#babel/preset-env' ] } )
.transform('glslify')
.bundle()
.pipe(source( entry ) )
.pipe(rename( {
extname: '.min.js'
}))
.pipe(buffer() )
.pipe(gulpif( options.has( 'production' ), stripDebug() ) )
.pipe(sourcemaps.init({ loadMaps: true }) )
.pipe(uglify())
.pipe(sourcemaps.write( '.' ))
.pipe(dest(constants.jsURL)) // constants.jsURL == "./dist/js/"
.pipe(browserSync.stream());
});
done();
}
The task inside the same file gulpfile.js
task("js", js);
My package.json file.
...
"devDependencies": {
"#babel/core": "^7.13.14",
"#babel/preset-env": "^7.13.12",
"babelify": "^10.0.0",
"browser-sync": "^2.26.14",
"browserify": "^17.0.0",
"browserify-shim": "^3.8.14",
"core-js": "^1.2.3",
"glslify": "^7.1.1",
"gsap": "^3.6.1",
"gulp": "^4.0.2",
"gulp-connect": "^2.2.0",
"gulp-if": "^3.0.0",
"gulp-notify": "^3.2.0",
"gulp-options": "^1.1.1",
"gulp-plumber": "^1.2.1",
"gulp-rename": "^2.0.0",
"gulp-sourcemaps": "^3.0.0",
"gulp-strip-debug": "^4.0.0",
"gulp-uglify": "^1.5.3",
"gulp-uglifycss": "^1.1.0",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
},
"babel": {
"presets": [
"#babel/preset-env"
]
},
"browserify": {
"transform": [
"browserify-shim"
]
},
...
Note that there is a babel section and a browserify section that are also needed.
And to run that gulp task simply do:
gulp js
One last thing, the example of the tutorials (thank you Alessandro Castellani) and my final solution, are mostly the same and also contain the other tasks to process the css files, the fonts, the images, and the html file. All of those files are moved to a "production" folder, in my case called dist.
Run with Android
All packages have been linked successfully.
I have tried
$ ./gradlew clean #in android folder
$ react-native start
$ react-native run-android
then jest that show error
Invariant Violation: Native module cannot be null
$ jest
FAIL __tests__/SignInScreen-test.js
● Test suite failed to run
Invariant Violation: Native module cannot be null.
at invariant (node_modules/invariant/invariant.js:40:15)
at new NativeEventEmitter (node_modules/react-native/Libraries/EventEmitter/NativeEventEmitter.js:37:7)
at Object.<anonymous> (node_modules/react-native-reanimated/src/ReanimatedEventEmitter.js:4:16)
at Object.<anonymous> (node_modules/react-native-reanimated/src/core/AnimatedCall.js:2:1)
console.group node_modules/redux-logger/dist/redux-logger.js:1
action persist/PERSIST # 05:17:04.459
console.log node_modules/redux-logger/dist/redux-logger.js:1
prev state {
authReducer: {
...
How can i fix this error or there are solutions to test React native app like Jest?
jestSetupFile.js
import mockAsyncStorage from '#react-native-community/async-storage/jest/async-storage-mock';
jest.mock('#react-native-community/async-storage', () => mockAsyncStorage);
jest.mock('react-native-keychain', () => ({
SECURITY_LEVEL_ANY: 'MOCK_SECURITY_LEVEL_ANY',
SECURITY_LEVEL_SECURE_SOFTWARE: 'MOCK_SECURITY_LEVEL_SECURE_SOFTWARE',
SECURITY_LEVEL_SECURE_HARDWARE: 'MOCK_SECURITY_LEVEL_SECURE_HARDWARE',
setGenericPassword: jest.fn().mockResolvedValue(),
getGenericPassword: jest.fn().mockResolvedValue(),
resetGenericPassword: jest.fn().mockResolvedValue(),
}));
package.json
"jest": {
"preset": "react-native",
"setupFiles": [
"./jestSetupFile.js"
]
},
SignInScreen-test.js
import {SignInScreen} from '../screens/SignInScreen';
describe('Test Component using hooks', () => {
test('SignInScreen', () => {
expect(<SignInScreen />).toMatchSnapshot();
});
});
This is more detail about my package.json
"dependencies": {
"#react-native-community/async-storage": "^1.7.1",
"#react-native-community/masked-view": "^0.1.6",
"#react-navigation/bottom-tabs": "^5.0.0-alpha.34",
"#react-navigation/native": "^5.0.0-alpha.24",
"#tradle/react-native-http": "^2.0.0",
"buffer": "^4.9.1",
"crypto": "^1.0.1",
"events": "^1.0.0",
"fast-deep-equal": "^3.1.1",
"http": "^0.0.0",
"https": "^1.0.0",
"https-browserify": "~0.0.0",
"perf_hooks": "0.0.1",
"performance": "^1.2.0",
"react": "16.11.0",
"react-native": "0.62.1",
"react-native-camera": "^3.15.1",
"react-native-charts-wrapper": "^0.5.7",
"react-native-crypto": "^2.1.0",
"react-native-elements": "^1.2.7",
"react-native-gesture-handler": "^1.6.0",
"react-native-keychain": "^4.0.5",
"react-native-paper": "^3.4.0",
"react-native-permissions": "^2.0.9",
"react-native-qrcode-scanner": "^1.3.1",
"react-native-qrcode-svg": "^6.0.3",
"react-native-randombytes": "^3.0.0",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^0.7.3",
"react-native-screens": "^2.1.0",
"react-native-svg": "^11.0.1",
"react-native-swiper": "^1.6.0-nightly.5",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "^4.0.10",
"react-navigation-material-bottom-tabs": "^2.1.5",
"react-navigation-stack": "^2.0.13",
"react-redux": "^7.1.1",
"readable-stream": "1.0.33",
"redux": "^4.0.4",
"redux-persist": "^6.0.0",
"request-promise": "^4.2.5",
"rn-nodeify": "^10.2.0",
"stellar-sdk": "^3.3.0",
"stream": "^0.0.2",
"stream-browserify": "^1.0.0",
"url": "~0.10.1",
"util": "~0.10.3",
"vm": "^0.1.0",
"vm-browserify": "0.0.4"
},
"devDependencies": {
"#babel/core": "7.6.4",
"#babel/runtime": "7.6.3",
"#react-native-community/eslint-config": "0.0.3",
"babel-jest": "^25.2.6",
"eslint": "6.6.0",
"jest": "24.9.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.9.0",
"redux-logger": "^3.0.6"
},
"jest": {
"preset": "react-native",
"setupFiles": [
"./jestSetupFile.js"
]
},
I had a similar issue and found the solution here. Additionally, I had to include an extra dependency on the "transformIgnorePatterns" node in the package.json
I'm trying to setup a gulp task using gulp-sass and when I try and run the task, I'm getting the following error:
TypeError: gulpSass.compiler.render is not a function
Which points to index.js in the gulp-sass folder.
gulpfile.js
var gulp = require('gulp');
var sass = require('gulp-sass');
sass.compiler = ('node-sass');
var cssConfig = {
src: './wwwroot/src/sass/*.scss',
dest: './wwwroot/dist/css/'
}
gulp.task('compileSass', function () {
gulp.src([cssConfig.src])
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest([cssConfig.dest]));
});
package.json
"devDependencies": {
"gulp": "^4.0.2",
"gulp-concat": "^2.6.1",
"gulp-cssmin": "^0.2.0",
"gulp-plumber": "^1.2.1",
"gulp-sass": "^4.0.2",
"gulp-uglify": "^3.0.2",
"node-sass": "^4.13.0",
"rimraf": "^3.0.0"
},
"dependencies": {
"bootstrap": "^4.4.0",
"jquery": "^3.4.1",
"popper.js": "^1.16.0"
}
}
Have I missed something?
So far I've stripped out all of my other tasks and reinstalled all packages just to be on the safe side. But no luck.
sass.compiler = ('node-sass'); was the issue. Removed and now ok.
I'm developing a django application with a reactjs front end that uses webpack for hot serving of javascript during development. Versions are pretty much all the latest:
"devDependencies": {
"#babel/cli": "^7.2.3",
"#babel/core": "^7.4.0",
"#babel/plugin-proposal-object-rest-spread": "^7.4.0",
"#babel/plugin-syntax-jsx": "^7.2.0",
"#babel/polyfill": "^7.4.0",
"#babel/preset-env": "^7.4.2",
"#babel/preset-react": "^7.0.0",
"ajv": "^6.10.0",
"auto-bind": "^1.2.1",
"babel-loader": "^8.0.5",
"bluebird": "^3.5.1",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chart.js": "^2.8.0",
"css-loader": "^2.1.1",
"d3": "^5.9.2",
"deep-equal": "^1.0.1",
"enzyme": "^3.9.0",
"file-loader": "^3.0.1",
"fusioncharts": "^3.13.4",
"history": "^4.9.0",
"immutability-helper": "^2.9.1",
"jquery": "^3.3.1",
"jquery.cookie": "^1.4.1",
"js-yaml": "^3.13.0",
"jsdom": "^14.0.0",
"lodash": "^4.17.11",
"mocha": "^4.1.0",
"moment": "^2.24.0",
"query-string": "^5.1.1",
"react": "^16.8.5",
"react-addons-update": "^15.6.2",
"react-bootstrap": "^0.31.5",
"react-codemirror": "^1.0.0",
"react-dom": "^16.8.5",
"react-dropzone": "^4.3.0",
"react-fusioncharts": "^1.0.5",
"react-hot-loader": "^3.1.3",
"react-input-autosize": "^2.2.1",
"react-numeric-input": "^2.2.3",
"react-popper": "^0.8.3",
"react-redux": "^6.0.1",
"react-router-dom": "^4.3.1",
"react-select": "^2.4.2",
"react-sortable-hoc": "^1.8.3",
"react-table": "^6.9.2",
"react-tooltip": "^3.10.0",
"reconnecting-websocket": "^4.1.10",
"redux": "^3.7.2",
"redux-form": "^8.1.0",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"select2": "^4.0.6-rc.1",
"style-loader": "^0.23.1",
"sunburst-chart": "^1.3.1",
"url-loader": "^1.1.2",
"uuid": "^3.3.2",
"webpack": "^4.29.6",
"webpack-bundle-tracker": "^0.3.0",
"webpack-cli": "^3.3.0",
"webpack-dev-server": "^3.2.1"
}
During development with the hot server running, everything works as expected. If I switch to production mode and use the main.js file which builds without warnings or error, The code fails in the browser with "Uncaught SyntaxError: Unexpected token (" on this area of the main.js:
"function"!=typeof Object.assign&&(Object.assign=function(e){"use strict";var t,n,r,o;if(null==e)throw new TypeError("Cannot convert undefined or null to object");for(t
/*! dontAppend && */a.canvas&&a.canvas.appendChild(t),o.node=o[0]=t,t.raphael=!0,t.raphaelid=o.id=e._oid++,o.matrix=e.matrix(),o.realPath=null,o.attrs=o.attrs||{},o.fol
/** !
* #license FusionCharts JavaScript Library
* Copyright FusionCharts Technologies LLP
* License Information at <http://www.fusioncharts.com/license>
*/
var r={name:"default",theme:{base:{chart:{labelDisplay:"stagger !important",caption:"Theme Caption \\!important",canvasBgColor:"#56EF22",borderThickness:"5 !important",
/** !
* #license FusionCharts JavaScript Library
* Copyright FusionCharts Technologies LLP
* License Information at <http://www.fusioncharts.com/license>
*
* #version //? write(JSON.parse(require('fs').readFileSync('./package.json')).version);
*/
function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.
"function" looks strange. In order to debug this, I turned the minimization off in the webpack config but when I do so the error disappears and the resulting (rather large) main.js works fine.
Any help on how to debug the problem further (or solve it) much appreciated. The full production and development configurations are as follows:
base.js:
const path = require("path");
module.exports = {
context: __dirname,
entry: '../assets/js/main',
output: {
path: path.resolve('./assets/bundles/'),
filename: "main.js"},
plugins: [],
module: {
rules: [
{
test: /\.js(|x)$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'}},
{
test: /\.css$/,
use: ['style-loader', 'css-loader']},
{
test: /\.(ttf|eot|svg|otf|gif)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: ['file-loader']
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
use: ['url-loader']
}]},
resolve: {
modules: ['assets/js', 'node_modules'],
extensions: ['.js', '.jsx']
},
devServer: {
contentBase: '../assets/bundles/',
hot: true,
headers: {
'Access-Control-Allow-Origin': '*'}}};
local.js (working fine):
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const config = require('./base.js');
// Use webpack dev server
config.mode = 'development';
config.entry = [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'../assets/js/main'];
// override django's STATIC_URL for webpack bundles
config.output.publicPath = 'http://localhost:3000/assets/bundles/';
// Add HotModuleReplacementPlugin and BundleTracker plugins
config.plugins = config.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
//new webpack.NoErrorsPlugin(),
new BundleTracker({filename: './webpack-stats.json'})]);
module.exports = config;
production.js (not working):
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const config = require('./base.js');
config.mode = 'production';
config.plugins = config.plugins.concat([
new BundleTracker({filename: './webpack-stats-prod.json'}),
// removes a lot of debugging code in React
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}}),
// keeps hashes consistent between compilations
new webpack.optimize.OccurrenceOrderPlugin()
]);
module.exports = config;
When running a unit test with Mocha we are getting the following token exception which points to Babel not transpiling.
node_modules/expo/src/Expo.js:2
import './environment/validate';
^^^^^^
SyntaxError: Unexpected token import
The mocha test points to a file that imports Constants from expo
import { Constants } from 'expo'
const config = Constants.manifest.extra
This is how the mocha opts and babel are configured
test/mocha.opts
--recursive
--require babel-register
.babelrc
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["transform-react-jsx-source"]
}
}
}
Dependencies
{
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-eslint": "^7.2.3",
"chai": "^4.1.2",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.0.1",
"eslint-plugin-import": "^2.3.0",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-react": "^7.0.1",
"jest-expo": "^24.0.0",
"mocha": "^5.0.0",
"react-native-scripts": "1.0.0",
"react-test-renderer": "16.0.0-alpha.6",
"rimraf": "^2.6.2",
"sinon": "^4.2.0"
},
"dependencies": {
"axios": "^0.16.2",
"dot-object": "^1.7.0",
"expo": "^24.0.0",
"google-libphonenumber": "^3.0.5",
"jwt-decode": "^2.2.0",
"lodash": "^4.17.4",
"moment": "^2.19.3",
"prop-types": "^15.5.10",
"react": "16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",
"react-native-google-places-autocomplete": "^1.3.6",
"react-native-modal": "^4.1.1",
"react-native-modal-datetime-picker": "^4.12.0",
"react-native-swipeable": "^0.6.0",
"react-native-vector-icons": "^4.2.0",
"react-navigation": "^1.0.0-beta.21",
"react-redux": "^5.0.5",
"redux": "^3.6.0",
"redux-devtools": "^3.4.0",
"redux-devtools-dock-monitor": "^1.1.2",
"redux-devtools-log-monitor": "^1.3.0",
"redux-logger": "^3.0.6",
"redux-saga": "^0.15.3",
"redux-thunk": "^2.2.0",
"styled-components": "^2.0.1"
}
}
We are running
yarn mocha
I just faced a similar error - many of my suites would break after I used Expo.AuthSession in a single file.
I fixed my issue by adding
jest.mock('expo', () => ({
AuthSession: {
getRedirectUrl: jest.fn(),
},
}));
to my global mock file.