|
| 1 | +import os from 'node:os'; |
1 | 2 | import path from 'node:path'; |
2 | 3 | import { stripVTControlCharacters as stripAnsi } from 'node:util'; |
3 | 4 | import { describe, expect, test } from '@rstest/core'; |
@@ -150,33 +151,34 @@ describe('build command', async () => { |
150 | 151 | runCliSync('build --format cjs', { |
151 | 152 | cwd: fixturePath, |
152 | 153 | }), |
153 | | - ).toThrowError(/rslib\.config not found in.*cli\/build\/no-config/); |
| 154 | + ).toThrowError(/rslib\.config not found in.*cli[\\/]build[\\/]no-config/); |
154 | 155 | }); |
155 | 156 |
|
156 | 157 | test('build options', async () => { |
157 | 158 | const fixturePath = path.join(__dirname, 'options'); |
158 | 159 | await fse.remove(path.join(fixturePath, 'dist/ok')); |
159 | 160 |
|
160 | | - const stdout = runCliSync( |
| 161 | + const command = |
161 | 162 | 'build ' + |
162 | | - '--entry="./src/*" ' + |
163 | | - '--dist-path=dist/ok ' + |
164 | | - '--no-bundle ' + |
165 | | - '--format=esm ' + |
166 | | - `--syntax='["node 14", "Chrome 103"]' ` + |
167 | | - '--target=web ' + |
168 | | - '--dts=true ' + |
169 | | - '--externals=./bar ' + |
170 | | - '--minify=false ' + |
171 | | - '--auto-extension=false', |
172 | | - { |
173 | | - cwd: fixturePath, |
174 | | - env: { |
175 | | - ...process.env, |
176 | | - DEBUG: 'rslib', |
177 | | - }, |
| 163 | + '--entry="./src/*" ' + |
| 164 | + '--dist-path=dist/ok ' + |
| 165 | + '--no-bundle ' + |
| 166 | + '--format=esm ' + |
| 167 | + `--syntax='["node 14", "Chrome 103"]' ` + |
| 168 | + '--target=web ' + |
| 169 | + '--dts=true ' + |
| 170 | + '--externals=./bar ' + |
| 171 | + '--minify=false ' + |
| 172 | + '--auto-extension=false'; |
| 173 | + |
| 174 | + const stdout = runCliSync(command, { |
| 175 | + cwd: fixturePath, |
| 176 | + shell: os.platform() === 'win32' ? 'powershell.exe' : undefined, |
| 177 | + env: { |
| 178 | + ...process.env, |
| 179 | + DEBUG: 'rslib', |
178 | 180 | }, |
179 | | - ); |
| 181 | + }); |
180 | 182 |
|
181 | 183 | const rslibConfigText = stripAnsi(extractRslibConfig(stdout)); |
182 | 184 | expect(rslibConfigText).toMatchInlineSnapshot(` |
|
0 commit comments