Closed xg-wang closed 3 years ago
I squashed the commits, this commit contains the new test setup 5451050
(#805)
@rwjblue (friendly ping) can I get a review on this PR?
@xg-wang the first few of your commits show a blank diff any idea why?
@kiwiupover
this test could be added to the basic-app test-package. Thanks for pointing out! I assume you are saying the tests I moved from
fastboot/test/fastboot-test.js
totest-packages/integration-tests/test/basic-test.js
, where fixturebasic-app
is used. Sorry I forgot to mention explicitly the migration path, which I'm thinking about to movebasic-app/test/*.js
totest-packages/integration-tests/test
. The thought here is we usetest-packages/basic-app
purely as a fixture app, and write tests undertest-packages/test/*.js
. I think the advantages are:
- we can test against multiple dists
- we shift the mental model about integration test boundaries. In
basic-app/test
we serve the app and test HTML response, in new setup we usefastboot.visit
directly, and test middleware (currentlypackages/fastboot-express-middleware/test/middleware-test.js
in another file (I haven't created yet). In new middleware integration test we don't need to test each test app, we just need to use some test app (basic-app should be enough most time) to cover middleware behavior- Not starting a server for every test file should execute faster
I prefer to move test-packages/basic-app/test/*-test.js
to test-packages/integration-tests/test/<maybe-new-name>-test.js
. It would be a simple move change at first, and change starting server to use fastboot.visit
when we have time (hope we will clean up the TODO 😄), as we migrate more old tests in ember-cli-fastboot
we don't need to start the server. I couldn't think of cons for doing so, except the churn of moving them.
Any thoughts?
For the PR description TODO item
Identify and document remaining duplicated tests from packages, then move them to test-packages
It's my miss I have not written more ideas, and I think this is important for deciding where to have the tests in this PR.
If you look at existing tests in each packages, all fastboot
, fastboot-express-middleware
, fastboot-app-server
use fixtures and implicitly rely on each other packages to build/serve the app. I think we need to move these integration pieces into test-packages/integration-tests/test/*-test.js
, or figure out the boundary and test the unit behaviors in package's own test folder. There need to be more thoughts go into each PR when doing so.
@xg-wang the first few of your commits show a blank diff any idea why?
@kiwiupover that's in the repo moved into the monorepo (for example fastboot
), I committed a pre-merge commit to move everything to packages/
so the later merge has no conflicts. GitHub may have some issue displaying the diff. I used the following script:
cd fastboot
mkdir -p ../packages/fastboot; mv .* * $_
mv ../packages .
mv packages/fastboot/.git .
git commit -m 'Monorepo setup: move to packages/fastboot'
# repeat for other repos
git remote add local/fastboot file://$HOME/Code/ember-fastboot/fastboot
git fetch local/fastboot
git merge local/fastboot/master --allow-unrelated-histories
GitHub may have some issue displaying them, you can see it's the file move by doing git show 0f5b00b8442bcc6c08fc2f69d4cfdb710e11eb3a
Paired with @kiwiupover, we walked through the PR and listed out the things needed:
Must:
After merge:
In follow-up PRs:
packages/
have unit testsbasic-app/test/
) move to integration-tests
packages/*
basic-app/test/
contain app test code using ember-cli-fastboot-testing
, to test fastboot provided test-helpers for app developers are working correctly@rwjblue this is ready to be merged!
What it does
This PR sets up the monorepo for several repositories under
ember-fastboot
org, and internal test packages for easier testing across several repos:packages/fastboot
: a low-level tool for anything relying on rendering Ember app in node environment (e.g., custom fastboot-server, prember)packages/ember-cli-fastboot
: required for all SSR ember apppackages/fastboot-express-middleware
: low-level tool for building custom fastboot-serverpackages/fastboot-app-server
: sane default for serving production apptest-packages/*
: internal ember apps for acceptance & e2e testing, not publishedAll packages to be published are bumped to
3.1.2
, which is the largest among the packages' versions.Also converting several
fastboot
repo tests that rely onember-cli-fastboot
for building ember app intotest-packages/integration-tests/test/basic-test.js
.ember-cli-fastboot
is already usingrelease-it-yarn-workspace
to releaseember-cli-fastboot
; we can continue to use the release flow to release others.Context
ember-fastboot
org has multiple packages useful for server-side rendered ember apps. Although these packages can be used together with different versions combination (e.g., https://github.com/ember-fastboot/fastboot/blob/v3.1.2/src/fastboot-schema.js is explicitly designed for compatibility), it is usually desired to keep them in sync from maintainers' perspective and use a combination of versions known good from users'.Currently, when bumping one package, several PRs need to cascade for other packages; it becomes even trickier when a fastboot contributor needs to make a change or write a test that interacts with different packages.
To merge these related packages into a monorepo, we can make maintaining and contributing to fastboot much easier.
The cons for doing monorepo is losing the flexibility to release different versions for each package and increasing the coupling, but they are not necessarily bad IMO.
Checklist
The monorepo setup needs to ensure a couple of things:
Next steps
test-packages
"node": "10.* || >=12"
whereas others are specifying"node": "10.* || 12.* || >= 14"