-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
496d5e5
commit 00fcad0
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
.moon/cache | ||
.eslintcache | ||
.rendered | ||
.test | ||
node_modules | ||
dist | ||
.DS_Store | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`cli > esbuild plugins 1`] = `Promise {}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { readFile } from 'node:fs/promises'; | ||
import { join } from 'node:path'; | ||
|
||
import { execa } from 'execa'; | ||
import { describe, expect, test } from 'vitest'; | ||
import strip from 'strip-ansi'; | ||
|
||
process.chdir(__dirname); | ||
|
||
describe('cli', async () => { | ||
test('esbuild plugins', async () => { | ||
const { stdout } = await execa({ | ||
cwd: __dirname, | ||
shell: true | ||
// Note: For some reason `pnpm exec` is fucking with our CWD, and resets it to | ||
// packages/jsx-email, which causes the config not to be found. so we use npx instead | ||
})`email create BatmanEmail --out ./.test/emails `; | ||
const plain = strip(stdout); | ||
|
||
console.log(plain); | ||
|
||
expect(plain).toContain('Creating a new template at '); | ||
expect(plain).toContain('Template BatmanEmail.tsx created'); | ||
|
||
const contents = readFile(join(__dirname, '.test/emails/BatmanEmail.tsx'), 'utf8'); | ||
expect(contents).toMatchSnapshot(); | ||
}); | ||
}); |