1 |
|
2 |
|
3 |
|
4 |
|
5 | 'use strict'
|
6 |
|
7 |
|
8 |
|
9 | const indexJsBud = require('../lib/index_js_bud.js')
|
10 | const assert = require('assert')
|
11 | const path = require('path')
|
12 |
|
13 | const coz = require('coz')
|
14 | const mkdirp = require('mkdirp')
|
15 |
|
16 | describe('index-js-bud', () => {
|
17 | const basedir = path.resolve(__dirname, '..')
|
18 | const tmpDir = path.resolve(basedir, 'tmp/index_js_bud_test/pkg-foo')
|
19 |
|
20 | before(async () => {
|
21 | mkdirp.sync(tmpDir)
|
22 | })
|
23 |
|
24 | after(async () => {
|
25 | })
|
26 |
|
27 | it('Index js bud', async () => {
|
28 | let bud = indexJsBud({
|
29 | dirname: __dirname
|
30 | })
|
31 | assert.ok(bud)
|
32 | bud.path = tmpDir + '/index.js'
|
33 | await coz.render(bud, {
|
34 | cwd: tmpDir
|
35 | })
|
36 | })
|
37 |
|
38 | it('Index mjs bud', async () => {
|
39 | let bud = indexJsBud({
|
40 | dirname: __dirname,
|
41 | mjs: true,
|
42 | })
|
43 | assert.ok(bud)
|
44 | bud.path = tmpDir + '/index.mjs'
|
45 | await coz.render(bud, {
|
46 | cwd: tmpDir
|
47 | })
|
48 | })
|
49 | })
|
50 |
|