Skip to content

chore(tailwind): Improve code for running Tailwind integration test #1935

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules

# testing
coverage
package-lock.json

# next.js
.next/
Expand Down
8 changes: 0 additions & 8 deletions packages/tailwind/integrations/_tests/nextjs.spec.ts

This file was deleted.

17 changes: 0 additions & 17 deletions packages/tailwind/integrations/_tests/utils/run-testing-command.ts

This file was deleted.

8 changes: 0 additions & 8 deletions packages/tailwind/integrations/_tests/vite.spec.ts

This file was deleted.

40 changes: 40 additions & 0 deletions packages/tailwind/integrations/integrations.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import path from 'node:path';
import shell from 'shelljs';

const $ = (command: string, cwd: string = path.resolve(__dirname, '..')) => {
const executionResult = shell.exec(command, {
cwd,
fatal: true,
silent: true,
});
if (executionResult.code !== 0) {
process.stdout.write(executionResult.stderr);
process.stderr.write(executionResult.stderr);
}
expect(
executionResult.code,
`Expected command "${command}" to work properly but it returned a non-zero exit code`,
).toBe(0);
};

describe('integrations', () => {
beforeAll(() => {
const packageLocation = path.resolve(__dirname, '../');
$('yalc installations clean @react-email/tailwind', packageLocation);
$('yalc publish', packageLocation);
});

const integrationsLocation = __dirname;

test("Tailwind works on the Next App's build process", () => {
const nextAppLocation = path.resolve(integrationsLocation, 'nextjs');
$('npm install', nextAppLocation);
$('npm run build', nextAppLocation);
});

test("Tailwind works on the Vite App's build process", () => {
const viteAppLocation = path.resolve(integrationsLocation, 'vite');
$('npm install', viteAppLocation);
$('npm run build', viteAppLocation);
});
});
2 changes: 1 addition & 1 deletion packages/tailwind/integrations/nextjs/next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

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