Here's an example of how to debug Mocha v4 if it hangs.
Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).
If you run your test, you'll notice it hangs:
$ mocha test.js
const t = require('@babel/types') | |
// generates "(typeof __webpack_require__ === "function" ? __non_webpack_require__ : require)" | |
const dynamicRequireExpr = () => t.parenthesizedExpression(t.conditionalExpression( | |
t.binaryExpression( | |
'===', | |
// we should look at typeof __non_webpack_require__ but '__webpack_require__' is known at build time and optimized right away | |
t.unaryExpression('typeof', t.identifier('__webpack_require__'), false), | |
t.stringLiteral('function') | |
), |
{ | |
"type": "object", | |
"$ref": "#/$defs/anyForm", | |
"properties": { | |
"definitions": { | |
"type": "object", | |
"additionalProperties": { "$ref": "#/$defs/anyForm" } | |
} | |
}, | |
"$defs": { |
// delete searches | |
(async () => { | |
const pause = (delay) => new Promise(resolve => setTimeout(resolve, delay)) | |
const btns = document.querySelectorAll('a[aria-label=Modifier]') | |
console.log('btns>', btns) | |
for (const btn of btns) { | |
btn.click() | |
await pause(1000) | |
const delLink = document.querySelector(`[data-ownerid=${btn.id}] a[ajaxify^="/ajax/timeline/delete/confirm"]`) | |
console.log('delLink>', delLink) |
// delete searches | |
(async () => { | |
const pause = (delay) => new Promise(resolve => setTimeout(resolve, delay)) | |
const btns = document.querySelectorAll('a[aria-label=Modifier]') | |
console.log('btns>', btns) | |
for (const btn of btns) { | |
btn.click() | |
await pause(1000) | |
const delLink = document.querySelector(`[data-ownerid=${btn.id}] a[ajaxify^="/ajax/timeline/delete/confirm"]`) | |
console.log('delLink>', delLink) |
Here's an example of how to debug Mocha v4 if it hangs.
Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).
If you run your test, you'll notice it hangs:
$ mocha test.js
import m1 from './module1' | |
import m2 from './module2' | |
console.log('module1:', m1.id, ' - module2:', m2.id) | |
export default { id: module.id } | |
export default { id: module.id } | |
const webpack = require('webpack') | |
module.exports = { | |
entry: './main.js', |
const { stringifyRequest } = require('loader-utils') | |
const postcss = require('postcss') | |
const cssModules = require('postcss-modules') | |
const cssNano = require('cssnano') | |
const cssNext = require('postcss-cssnext') | |
const _ = require('lodash') | |
// Why this loader ? | |
// This loaded is inteded to load css with a much smaller footprint than traditional css-loader / style-loader | |
// css-loader and styles-loader have an overhead of ~5kb of runtime when compiled and minified (growing with number of css imports) |
alert('Hello !') |
Install svg-inline-loader for webpack :
npm install svg-inline-loader --save-dev
Add it to your loaders in module.loaders
section of webpack.config.js
:
{
test: /\.svg$/,
loader: 'svg-inline-loader'
struct Dynamic<T> { | |
let get: () -> T | |
init(_ get: @autoclosure @escaping () -> T) { | |
self.get = get | |
} | |
var value: T { return get() } | |
} | |
var i: Int = 0 |