-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Failing "Create-toolpad-app:test" test on cloning repository #2414
Comments
👍 Yes, this is a bit of a flaky and slow test. It's installing the node modules for the created toolpad project. @bharatkashyap Perhaps we should omit installation during the tests? |
It's annoying that we can't see the output of running the diff --git a/packages/create-toolpad-app/tests/index.spec.ts b/packages/create-toolpad-app/tests/index.spec.ts
index 85e19a6d5..4976781f0 100644
--- a/packages/create-toolpad-app/tests/index.spec.ts
+++ b/packages/create-toolpad-app/tests/index.spec.ts
@@ -3,6 +3,7 @@ import * as path from 'path';
import * as url from 'url';
import readline from 'readline';
import { Readable } from 'stream';
+import { text } from 'stream/consumers';
import { execa, ExecaChildProcess } from 'execa';
import { jest } from '@jest/globals';
import { once } from 'events';
@@ -38,9 +39,11 @@ test('create-toolpad-app can bootstrap a Toolpad app', async () => {
testDir = await fs.mkdtemp(path.resolve(currentDirectory, './test-app-'));
cp = execa(cliPath, [path.basename(testDir)], {
cwd: currentDirectory,
+ stdio: 'pipe',
});
- const result = await cp;
- expect(result.stdout).toMatch('Run the following to get started');
+ cp.stdout!.pipe(process.stdout);
+ const stdout = await text(cp.stdout!);
+ expect(stdout).toMatch('Run the following to get started');
const packageJsonContent = await fs.readFile(path.resolve(testDir, './package.json'), {
encoding: 'utf-8',
}); and try again? This should make visible where it gets stuck. |
I figured diff --git a/packages/create-toolpad-app/tests/index.spec.ts b/packages/create-toolpad-app/tests/index.spec.ts
index 85e19a6d..0d2ca923 100644
--- a/packages/create-toolpad-app/tests/index.spec.ts
+++ b/packages/create-toolpad-app/tests/index.spec.ts
@@ -6,8 +6,9 @@ import { Readable } from 'stream';
import { execa, ExecaChildProcess } from 'execa';
import { jest } from '@jest/globals';
import { once } from 'events';
+import fetch from 'node-fetch';
-jest.setTimeout(60000);
+jest.setTimeout(600000);
const currentDirectory = url.fileURLToPath(new URL('.', import.meta.url));
Let me know if you still need me to go ahead and do what you are suggesting. |
👍 Much appreciated if you'd open a PR. Importing from To avoid multiplying our ci runtime by 10 for failing create-toolpad-app tests we could do something like: jest.setTimeout(process.env.CI ? 60000 : 600000); but if the shorter timeout works for you with the
Yes, let's include these changes, it's very helpful to see this output when debugging the test. |
Duplicates
Latest version
Steps to reproduce 🕹
Steps:
cd mui-toolpad
yarn install
yarn test
-> Initially fails 2 / 3 testsyarn dev
yarn test
-> fails 1 / 3 testsCurrent behavior 😯
Running
yarn test
Immediately after cloning the repository, results in two of the tests failing.Running
yarn dev
andyarn test
after that results in one test failing: create-toolpad-app:testExpected behavior 🤔
I expect the tests to pass considering I haven't made any changes
Context 🔦
No response
Your environment 🌎
OS: "Ubuntu 22.04.2 LTS"
Node: v16.20.1
MUI: v0.1.21
The text was updated successfully, but these errors were encountered: