-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdist-test.js
More file actions
40 lines (36 loc) · 969 Bytes
/
dist-test.js
File metadata and controls
40 lines (36 loc) · 969 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const assert = require('assert')
const walk = require('./walk')
const distTest = async function main() {
const filepaths = []
for await (const filepath of walk(`${__dirname}/dist`)) {
filepaths.push(filepath)
}
filepaths.push(`${__dirname}/index.js`)
filepaths.push(`${__dirname}/es.js`)
for (const path of filepaths) {
if (
path.includes('.es')
|| path.endsWith('.mjs')
|| path.includes('es.js')
) {
// test in dist-test.mjs
}
else {
const required = require(path)
console.log('Successfully required', path)
if (
path.includes('rubico.js')
|| path.includes('rubico.min.js')
|| path.includes('index.js')
) {
assert.equal(Object.keys(required).length, 31)
} else if (
path.includes('Transducer.js')
|| path.includes('Transducer.min.js')
) {
assert.equal(Object.keys(required).length, 6)
}
}
}
}
distTest()