Skip to content

Commit

Permalink
Add execa package and update function calls to use execaCommandSync
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Feb 23, 2024
1 parent cbd2e1c commit 5d60e3e
Show file tree
Hide file tree
Showing 4 changed files with 3,455 additions and 367 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"cheerio": "1.0.0-rc.12",
"cross-env": "^7.0.3",
"css-shared": "workspace:^",
"execa": "^8.0.1",
"fast-glob": "^3.3.2",
"firebase-admin": "^11.11.1",
"jest-extended": "^4.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/tests/extract/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from 'child_process'
import { execaCommandSync } from 'execa'
import fs, { readFileSync } from 'fs'
import { join } from 'path'

Expand All @@ -11,6 +11,6 @@ it('basic extract', async () => {
}
}
`, { flag: 'w' })
execSync('tsx ../../src/bin extract', { cwd: __dirname })
execaCommandSync('tsx ../../src/bin extract', { cwd: __dirname })
expect(readFileSync(join(__dirname, '.virtual/master.css')).toString()).toMatch(/(fg\\:primary|m\\:12x|text\\:center|font\\:sans|font\\:heavy|font\\:48)/)
})
6 changes: 3 additions & 3 deletions packages/cli/tests/render/test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from 'child_process'
import { execaCommandSync } from 'execa'
import fs from 'fs'
import dedent from 'ts-dedent'
import { join } from 'path'
Expand All @@ -17,7 +17,7 @@ it('render css text into <head>', async () => {
</body>
</html>
`)
execSync(`tsx ../../src/bin render "${filePath}"`, { cwd: __dirname })
execaCommandSync(`tsx ../../src/bin render ${filePath}`, { cwd: __dirname })
expect(fs.readFileSync(filePath, { encoding: 'utf-8' })).toMatch(dedent`
<html>
<head>
Expand Down Expand Up @@ -46,7 +46,7 @@ it('render css text into head and create <style id="master">', async () => {
</body>
</html>
`)
execSync(`tsx ../../src/bin render "${filePath}"`, { cwd: __dirname })
execaCommandSync(`tsx ../../src/bin render ${filePath}`, { cwd: __dirname })
expect(fs.readFileSync(filePath, { encoding: 'utf-8' })).toMatch(dedent`
<html>
<head>
Expand Down
Loading

0 comments on commit 5d60e3e

Please sign in to comment.