Skip to content

Commit f15bfc6

Browse files
committed
chore(tailwind): Improve code for running Tailwind integration test (#1935)
1 parent a8939bc commit f15bfc6

File tree

13 files changed

+3369
-14313
lines changed

13 files changed

+3369
-14313
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules
77

88
# testing
99
coverage
10+
package-lock.json
1011

1112
# next.js
1213
.next/

packages/tailwind/integrations/_tests/nextjs.spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/tailwind/integrations/_tests/utils/run-testing-command.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

packages/tailwind/integrations/_tests/vite.spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import path from 'node:path';
2+
import shell from 'shelljs';
3+
4+
const $ = (command: string, cwd: string = path.resolve(__dirname, '..')) => {
5+
const executionResult = shell.exec(command, {
6+
cwd,
7+
fatal: true,
8+
silent: true,
9+
});
10+
if (executionResult.code !== 0) {
11+
process.stdout.write(executionResult.stderr);
12+
process.stderr.write(executionResult.stderr);
13+
}
14+
expect(
15+
executionResult.code,
16+
`Expected command "${command}" to work properly but it returned a non-zero exit code`,
17+
).toBe(0);
18+
};
19+
20+
describe('integrations', () => {
21+
beforeAll(() => {
22+
const packageLocation = path.resolve(__dirname, '../');
23+
$('yalc installations clean @react-email/tailwind', packageLocation);
24+
$('yalc publish', packageLocation);
25+
});
26+
27+
const integrationsLocation = __dirname;
28+
29+
test("Tailwind works on the Next App's build process", () => {
30+
const nextAppLocation = path.resolve(integrationsLocation, 'nextjs');
31+
$('npm install', nextAppLocation);
32+
$('npm run build', nextAppLocation);
33+
});
34+
35+
test("Tailwind works on the Vite App's build process", () => {
36+
const viteAppLocation = path.resolve(integrationsLocation, 'vite');
37+
$('npm install', viteAppLocation);
38+
$('npm run build', viteAppLocation);
39+
});
40+
});

packages/tailwind/integrations/nextjs/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

0 commit comments

Comments
 (0)