Skip to content
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

[cli] Tests not detecting errors returned during formatting code #171

Open
danstepanov opened this issue Jan 17, 2024 · 0 comments
Open

Comments

@danstepanov
Copy link
Owner

danstepanov commented Jan 17, 2024

Expected Behavior

If any error appears during the process of generating a project, the associated test should fail.

Current Behavior

Screenshot 2024-01-17 at 3 45 33 PM Screenshot 2024-01-17 at 3 45 00 PM

Despite the above errors, when running this test individually, the associated test passes.

Possible Solution

GlueGun's system tool offers spawn() and run() commands which both return the result of running a command (either as a string or an object). Perhaps it possible to use the second parameter options passed to these commands in an effort to log this information or throw [during project generation](url such that the test will fail?

Steps to Reproduce

  1. Run npx create-expo-stack@latest myTestProject --expo-router --drawer --nativewind --yarn
  2. Observe the errors seen in the above screenshot
  3. Using your local version of create expo stack, run the following test, particularly the one for the above command. Notice that I have added the line not.toContain('error ') in an effort to catch that line.
// --expo-router drawer nativewind and yarn
test(`generates a project with expo-router drawer and nativewind with yarn`, async () => {
  const output = await cli(`myTestProject --expo-router --drawer --nativewind --yarn`);
  console.log('output: ', output)
  expect(output).toContain('yarn');
  expect(output).not.toContain('error ');
});
  1. The test will pass, which is incorrect. Upon inspecting the output string, you will see that the results of the formatting command run here are not included, despite the fact that they are shown in the cli output to the user.

Relevant Docs

@danstepanov danstepanov changed the title [cli] Tests not detecting errors [cli] Tests not detecting errors returned during formatting code Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant