Add line "browserslist": ["since 2017-06"]
to your package.json
file. Babel won't add polyfills for async/await, es6.
So you don't need to install and add reneneratorRuntime
(or babel-polyfill
) to your bundle!
- Find browser's executable path:
Go tochrome://version/
(inside Chrome browser) and find"Executable Path"
variable ("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
in my case) - Modify your script:
const browser = await puppeteer.launch({
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
args: ['--disable-blink-features=AutomationControlled'],
headless: false,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getJSON(response) { | |
if (response.status === 204) return ''; | |
return response.json(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express') | |
const cors = require('cors') | |
const bodyParser = require("body-parser") | |
const app = express() | |
const PORT = process.env.port || 4000 | |
// to parse req.body for POST-requests | |
app.use(bodyParser.urlencoded({extended: true})); | |
app.use(bodyParser.json()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function walk(dir) { | |
let files = await fs.readdir(dir) | |
files = await Promise.all(files.map(async file => { | |
const filePath = path.join(dir, file) | |
const stats = await fs.stat(filePath) | |
if (stats.isDirectory()) { | |
return walk(filePath); | |
} | |
else if (stats.isFile()) { | |
return filePath; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"workbench.startupEditor": "none", | |
"workbench.statusBar.feedback.visible": false, | |
"window.menuBarVisibility": "toggle", | |
"workbench.statusBar.visible": false, | |
"workbench.activityBar.visible": false, | |
"editor.fontFamily": "JetBrains Mono, Menlo, Monaco, 'Courier New', monospace", | |
"editor.fontSize": 14, | |
"editor.fontLigatures": true, | |
"editor.lineHeight": 24, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withImages = require("next-images"); | |
const nextConfig = {...} | |
module.exports = (phase) => { | |
if (phase === PHASE_DEVELOPMENT_SERVER || phase === PHASE_PRODUCTION_BUILD) { | |
const withCSS = require("@zeit/next-css"); | |
return withCss(withImages(nextConfig))))); | |
} | |
return withImages(nextConfig); | |
}; |
- Run single test
node <path-to-jest> -i <you-test-file> -c <jest-config> -t "<test-block-name>"