main
1// Copyright 2024 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15import assert from 'node:assert'
16import { describe, test } from 'node:test'
17import {
18 bus,
19 nothrow,
20 quiet,
21 versions,
22 version,
23 VERSION,
24 $,
25 log,
26 cd,
27 syncProcessCwd,
28 usePowerShell,
29 usePwsh,
30 useBash,
31 kill,
32 ProcessOutput,
33 ProcessPromise,
34 defaults,
35 dotenv,
36 minimist,
37 chalk,
38 fs,
39 which,
40 YAML,
41 ps,
42 quote,
43 quotePowerShell,
44 within,
45 os,
46 argv,
47 parseArgv,
48 updateArgv,
49 globby,
50 glob,
51 sleep,
52 fetch,
53 echo,
54 question,
55 stdin,
56 retry,
57 expBackoff,
58 spinner,
59 path,
60 tempdir,
61 tempfile,
62 tmpdir,
63 tmpfile,
64} from '../build/index.js'
65
66describe('index', () => {
67 test('has proper exports', () => {
68 // index
69 assert(nothrow)
70 assert(quiet)
71 assert(version)
72 assert(versions)
73 assert.equal(version, VERSION)
74
75 // core
76 assert($)
77 assert(ProcessOutput)
78 assert(ProcessPromise)
79 assert(cd)
80 assert(syncProcessCwd)
81 assert(log)
82 assert(kill)
83 assert(defaults)
84 assert(within)
85 assert(usePowerShell)
86 assert(usePwsh)
87 assert(useBash)
88
89 // goods
90 assert(os)
91 assert(argv)
92 assert(parseArgv)
93 assert(updateArgv)
94 assert(globby)
95 assert(glob)
96 assert(sleep)
97 assert(fetch)
98 assert(echo)
99 assert(question)
100 assert(stdin)
101 assert(retry)
102 assert(expBackoff)
103 assert(spinner)
104 assert(path)
105
106 // vendor
107 assert(minimist)
108 assert(chalk)
109 assert(fs)
110 assert(which)
111 assert(YAML)
112 assert(ps)
113 assert(dotenv)
114
115 // utils
116 assert(quote)
117 assert(quotePowerShell)
118 assert(tempdir)
119 assert(tmpdir)
120 assert(tmpfile)
121 assert(tempfile)
122 })
123
124 test('bus is locked', () => {
125 assert.throws(() => bus.wrap('test', () => {}), /locked/)
126 })
127})