2017-08-04 06:50:41 +02:00
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
2017-09-12 01:21:58 +02:00
|
|
|
const pump = require('pump')
|
2017-08-04 06:50:41 +02:00
|
|
|
const browserify = require('browserify')
|
|
|
|
const tests = fs.readdirSync(path.join(__dirname, 'lib'))
|
|
|
|
const bundlePath = path.join(__dirname, 'bundle.js')
|
2016-10-13 05:03:14 +02:00
|
|
|
|
2017-08-04 06:50:41 +02:00
|
|
|
const b = browserify()
|
2016-10-13 05:03:14 +02:00
|
|
|
|
2017-08-04 07:24:22 +02:00
|
|
|
const writeStream = fs.createWriteStream(bundlePath)
|
2016-10-13 05:03:14 +02:00
|
|
|
|
2017-08-04 07:24:22 +02:00
|
|
|
tests.forEach(function (fileName) {
|
2017-09-12 01:21:58 +02:00
|
|
|
const filePath = path.join(__dirname, 'lib', fileName)
|
|
|
|
console.log(`bundling test "${filePath}"`)
|
|
|
|
b.add(filePath)
|
2017-08-04 07:24:22 +02:00
|
|
|
})
|
2016-10-13 05:03:14 +02:00
|
|
|
|
2017-09-12 01:21:58 +02:00
|
|
|
pump(
|
|
|
|
b.bundle(),
|
|
|
|
writeStream,
|
|
|
|
(err) => {
|
|
|
|
if (err) throw err
|
2017-09-12 01:32:07 +02:00
|
|
|
console.log(`Integration test build completed: "${bundlePath}"`)
|
|
|
|
process.exit(0)
|
2017-09-12 01:21:58 +02:00
|
|
|
}
|
2018-03-12 02:52:27 +01:00
|
|
|
)
|