Skip to content

Commit

Permalink
refactor: use os eol.
Browse files Browse the repository at this point in the history
  • Loading branch information
knightedcodemonkey committed Sep 30, 2024
1 parent cf0b6f6 commit 96daa87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { pathToFileURL } from 'node:url'
import { realpath } from 'node:fs/promises'
import { spawnSync } from 'node:child_process'
import { cwd, platform } from 'node:process'
import { EOL } from 'node:os'

const log = (color = '\x1b[30m', msg = '') => {
// eslint-disable-next-line no-console
Expand All @@ -23,7 +24,7 @@ const getCompileFiles = (tscBinPath, wd = cwd()) => {
// Exclude node_modules and empty strings.
return stdout
.toString()
.split('\n')
.split(EOL)
.filter(path => !/node_modules|^$/.test(path))
}

Expand Down
5 changes: 3 additions & 2 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const errDist = resolve(__dirname, '__fixtures__/compileErrors/dist')
const rmDist = async distPath => {
await rm(distPath, { recursive: true, force: true })
}
const shell = platform === 'win32'

describe('duel', () => {
before(async () => {
Expand Down Expand Up @@ -120,13 +121,13 @@ describe('duel', () => {
const { status: statusEsm } = spawnSync(
'node',
['test/__fixtures__/esmProject/dist/index.js'],
{ stdio: 'inherit', shell: platform === 'win32' },
{ shell, stdio: 'inherit' },
)
assert.equal(statusEsm, 0)
const { status: statusCjs } = spawnSync(
'node',
['test/__fixtures__/esmProject/dist/cjs/index.cjs'],
{ stdio: 'inherit' },
{ shell, stdio: 'inherit' },
)
assert.equal(statusCjs, 0)
})
Expand Down

0 comments on commit 96daa87

Please sign in to comment.