Skip to content

Commit

Permalink
Finalized setup and teardown scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenewald committed Apr 30, 2023
1 parent 820cd93 commit 1964b0d
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 518 deletions.
30 changes: 30 additions & 0 deletions test/integration/fixtures/basic-integration-test/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
'use strict';
const { join } = require('path');
const { execSync, spawn } = require('child_process');

beforeAll(async () => {
// Start a local server to serve the test project
const server = spawn('npx', ['serve', '-s', 'build', '-l', global.PORT], {
cwd: join(__dirname, 'test-project'),
});

// Log any server errors to the console
server.stderr.on('data', (data) => {
console.error(`stderr: ${data}`);
});

// Leave time for the server to initialize
await new Promise(resolve => {setTimeout(resolve, 3000)});
});

test("Should have the expected styles", async () => {
await page.goto(global.URL, {'waitUntil':'domcontentloaded'}); //todo: make the url changeble

const cracoTestText = await page.$eval('#craco-test', (element) => element.textContent);
expect(cracoTestText).toBe("CRACO is working!");
});

afterAll(() => {
// Stop the local server
execSync(`kill $(lsof -t -i:${global.PORT})`, { cwd: __dirname, stdio: 'ignore' });
});

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
{
"name": "craco-postcss-test",
"name": "craco-basic-test",
"version": "0.1.0",
"private": true,
"dependencies": {
"autoprefixer": "*",
"postcss": "*",
"postcss-custom-properties": "*",
"postcss-nested": "*",
"react": "*",
"react-dom": "*"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"web-vitals": "^3.3.1"
},
"scripts": {
"start": "craco start",
Expand Down
68 changes: 0 additions & 68 deletions test/integration/fixtures/custom-postcss-config/index.test.js

This file was deleted.

Loading

0 comments on commit 1964b0d

Please sign in to comment.