Harder, Better, Faster, Stronger CLI integration tests#476
Harder, Better, Faster, Stronger CLI integration tests#476javiertoledo merged 8 commits intomasterfrom
Conversation
05438fe to
95cd20e
Compare
packages/framework-integration-tests/integration/cli/cli.event.integration.ts
Show resolved
Hide resolved
packages/framework-integration-tests/integration/cli/cli.project.integration.ts
Show resolved
Hide resolved
|
|
||
| export const removeFolders = (paths: Array<string>): Array<Promise<void>> => | ||
| paths.map((path: string) => rmdir(path, { recursive: true })) | ||
| export const createFolder = (folder: string): void => { |
There was a problem hiding this comment.
Maybe it'd be better to call this ensureFolderExists? As it doesn't create it if it exists
There was a problem hiding this comment.
That makes sense...
…tern and stronger
…p function somewhere else :-#
9439470 to
a30b973
Compare
|
Ooops, AWS tests failing, I'll investigate... |
charlietfe
left a comment
There was a problem hiding this comment.
Nothing to add, much cleaner and easy to understand tests. I did a nitty picky comment that you can omit it if you want.
So let's 🚢 🇮🇹 dude!
|
|
||
| describe('Command', () => { | ||
| const cliPath = path.join('..', 'cli', 'bin', 'run') | ||
| const cliPath = path.join('..', '..', 'cli', 'bin', 'run') |
There was a problem hiding this comment.
Nit-picky, it looks like the path segments never change in cli tests. Does it make sense to use a placeholder constant with the segments and add that const to the fileHelper?
| it('should create a new command', async () => { | ||
| const expectedOutputRegex = new RegExp( | ||
| /(.+) boost (.+)?new:command(.+)? (.+)\n- Verifying project\n(.+) Verifying project\n- Creating new command\n(.+) Creating new command\n(.+) Command generated!\n/ | ||
| ['boost new:command', 'Verifying project', 'Creating new command', 'Command generated'].join('(.|\n)*') |
There was a problem hiding this comment.
Oh god, what we had here, clearness to the rescue!
adriangmweb
left a comment
There was a problem hiding this comment.
It looks great! Much cleaner and easier to understand now.
Integrations tests are failing when trying to create a scheduled command, but anyway LGTM! 🚀
- Moved it to the AWS provider integration tests - Introduced a specific event - Used the CartReadModel, which wasn't restricted to a specific user role
Description
We have been experiencing reliability issues with CLI integration tests. They were directly changing the files from the sample project in the package
framework-integration-tests, introducing issues that then affected deployment tests and others, as they all rely on these files to be unaltered.You may want to listen to the OST of this PR while reviewing it 😎
Changes
In this PR, I've reworked the CLI integration tests with the hopes of solving the mentioned reliability issues and make the tests faster the process. To do that I've done the following:
setup.ts(Tests should be self-contained)createSandboxProjectfunction that creates a new copy of the sample project in the integration tests package.execcalls with the promise-wrapped version from packagechild-process-promisefor consistency and code simplicity.loadFixturehelper and moved calls to low-levelfsfunctions tofileHelper.tsto make tests code more readableskipGitandskipInstallflags (functionally there's no difference)Checks
-Updated documentation accordingly(not needed)Additional notes
This change doesn't guarantee that other integration tests are reliable, I'll tackle that in future PRs.