@@ -143,7 +143,7 @@ describe('win32ToWin32WSL2.test.mjs', function(){
143143 * wsl param tests
144144 *
145145 */
146- const WSLPassTests = [
146+ export const WSLPassTests = [
147147 [ "C:\\Users\\Public\\Documents" , "/mnt/c/Users/Public/Documents" ] , //maybe append with quotes instead?
148148 [ "C:\\Users\\Public\\temp spaces\\a\\b c\\d" , "/mnt/c/Users/Public/temp\\ spaces/a/b\\ c/d" ] ,
149149 [ "C:\\Users\\Public\\temp spaces\\a\\b c\\d" , "/mnt/c/Users/Public/temp\\ spaces/a/b\\ c/d" ] ,
@@ -165,19 +165,52 @@ for (let i = 0; i < ogLength; i++) {
165165 * parameterized tests
166166 */
167167import { spawnSync } from "node:child_process" ;
168+ import { createMochaCliExe } from "##/lib/test-utils/mocha-cli-exec.mjs" ;
168169
169170describe ( 'WSLPassTests' , function ( ) {
171+ /** @type {string|'Win32ToWin32WSL2BinaryPath' } */
172+ const W2WB = "lib/bin_build/dist/index-win.exe" ;
173+ const assertW2Wb = createMochaCliExe ( W2WB ) ;
174+ /* raw */
175+ it ( 'WSLPassTests mocha exe' , function ( ) {
176+ const output = spawnSync (
177+ // `"${W2WB}" [C:\\` //cmd needs to double quote
178+ `"${ W2WB } "` , [ WSLPassTests [ 0 ] [ 0 ] ] , { shell :true }
179+ ) ;
180+ if ( output . status !== 0 ) {
181+ console . error ( output ) ;
182+ console . log ( output . stdout . toString ( ) )
183+ console . error ( output . stderr . toString ( ) )
184+ throw new Error ( "status not 0" ) ;
185+ }
186+ const actual = output . stdout . toString ( ) . trim ( ) ;
187+ assert . strictEqual ( actual , WSLPassTests [ 0 ] [ 1 ] ) ;
188+ } ) ;
189+ /* wrapper note reversed */
190+ it ( 'WSLPassTests assertW2Wb' , function ( ) {
191+ assertW2Wb ( WSLPassTests [ 0 ] [ 1 ] , WSLPassTests [ 0 ] [ 0 ] ) ;
192+ } ) ;
193+ /* wrapper note reversed */
194+ it ( 'WSLPassTests assertW2Wb - spaces' , function ( ) {
195+ assertW2Wb ( WSLPassTests [ 1 ] [ 1 ] , WSLPassTests [ 1 ] [ 0 ] ) ;
196+ } ) ;
197+ /**/
170198 for ( let i = 0 ; i < WSLPassTests . length ; i ++ ) {
171199 const [ inputWinPath , expectedMntPath , wslPassTestIndex ] = WSLPassTests [ i ] ;
172200 it ( `WSLPassTests MJS ${ wslPassTestIndex } ` , function ( ) {
173201 // console.log(wslPassTestIndex,inputWinPath);
174202 const actual = win32ToWin32WSL2 ( inputWinPath ) ;
175203 assert . strictEqual ( actual , expectedMntPath ) ;
176204 } ) ;
177- it ( `WSLPassTests ps1 ${ wslPassTestIndex } ` , function ( ) {
178- // console.log(wslPassTestIndex,inputWinPath);
179- const output = spawnSync ( inputWinPath ) ;
180- assert . strictEqual ( actual , expectedMntPath ) ;
205+ /* scrapping ps1 / sh using exe for now */
206+ // it(`WSLPassTests ps1 ${wslPassTestIndex}`, function () {
207+ // // console.log(wslPassTestIndex,inputWinPath);
208+ // const output = spawnSync(inputWinPath);
209+ // assert.strictEqual(actual,expectedMntPath);
210+ // });
211+ it ( `WSLPassTests exe ${ wslPassTestIndex } ` , function ( ) {
212+ // // console.log(wslPassTestIndex,inputWinPath);
213+ assertW2Wb ( expectedMntPath , [ inputWinPath ] ) ;
181214 } ) ;
182215 }
183216} ) ;
0 commit comments