Files
elasticsearch-js/test/unit/esm/index.test.js
github-actions[bot] 9c76898fb1 [Backport 7.x] ESM support (#1236)
Co-authored-by: Tomas Della Vedova <delvedor@users.noreply.github.com>
2020-06-26 11:58:43 +02:00

20 lines
521 B
JavaScript

'use strict'
const t = require('tap')
const semver = require('semver')
if (semver.lt(process.versions.node, '12.17.0')) {
t.skip('Skip because Node version < 12.17.0')
t.end()
} else {
// Node v8 throw a `SyntaxError: Unexpected token import`
// even if this branch is never touch in the code,
// by using `eval` we can avoid this issue.
// eslint-disable-next-line
new Function('module', 'return import(module)')('./index.mjs').catch((err) => {
process.nextTick(() => {
throw err
})
})
}