roninoss / create-expo-stack

CLI tool to initialize a React Native application with Expo. Provides options to include Typescript, file-based routing via Expo Router, configuration based routing via pure React Navigation, styling via Nativewind, Restyle, Unistyles, StyleSheets, or Tamagui, and/or backend as a service such as Firebase and Supabase.

Home Page:https://rn.new

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[cli] Tests not detecting errors returned during formatting code

danstepanov opened this issue · comments

commented

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