Skip to content

Commit

Permalink
test(csv-issues-esm): use spawn instead of exec
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Aug 11, 2023
1 parent 586ef58 commit 61d4eea
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions demo/issues-esm/test/samples.coffee
@@ -1,7 +1,7 @@

import fs from 'fs';
import path from 'path';
import { exec } from 'child_process';
import fs from 'node:fs';
import path from 'node:path';
import { spawn } from 'node:child_process';
import { dirname } from 'dirname-filename-esm';

__dirname = dirname import.meta
Expand All @@ -17,10 +17,11 @@ describe 'Samples', ->
.map (sample) ->
it "Sample #{sample}", (callback) ->
ext = /\.(\w+)?$/.exec(sample)[0]
bin = switch ext
cmd = switch ext
when '.js'
'node'
when '.ts'
'node --loader ts-node/esm'
exec "#{bin} #{path.resolve dir, sample}", (err, stdout, stderr) ->
callback err
spawn(cmd, [path.resolve dir, sample])
.on 'close', (code) -> callback(code isnt 0 and new Error 'Failure')
.stdout.on 'data', (->)

0 comments on commit 61d4eea

Please sign in to comment.