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

Organize tests a bit #5116

Merged
merged 8 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/logged_in.sh
$ . ${TESTDIR}/_helpers/logged_in.sh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, what is the underscore convention? Does this get considered as "not a test" by default?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah just convention for "private", and also sorts it at the top of the list of things in the directory so it's easier to find non-test things. Otherwise, I found that existing helpers get missed and duplicated more easily.


Link Test Run
$ ${TURBO} link --__test-run
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/logged_in.sh
$ . ${TESTDIR}/_helpers/logged_in.sh

Logout while logged in
$ ${TURBO} logout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)

Run a build to get a local cache.
$ ${TURBO} run build --output-logs=none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) inputs
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) inputs

Running build for my-app succeeds
$ ${TURBO} run build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) run_logging
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) run_logging

# [ ] error exit
# [ ] outputMode: errors-only
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) run_logging
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) run_logging

# Run for the first time with --log-prefix=none
$ ${TURBO} run build --log-prefix=none
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)

Verbosity level 1
$ ${TURBO} build -v --filter=util --force
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) invalid_turbo_json
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) invalid_turbo_json

Expect warnings
$ ${TURBO} build -v --dry > /dev/null
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) monorepo_dependency_error
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) monorepo_dependency_error
Run without --continue
$ ${TURBO} build
\xe2\x80\xa2 Packages in scope: my-app, other-app, some-lib (esc)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)

Run a dry run
$ ${TURBO} build --dry=json | jq .packages
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)

# Running non-existent tasks errors
$ ${TURBO} run doesnotexist
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd) monorepo_one_script_error
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd) monorepo_one_script_error

Check error is properly reported
Note that npm reports any failed script as exit code 1, even though we "exit 2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Setup
$ . ${TESTDIR}/../../helpers/setup.sh
$ . ${TESTDIR}/_helpers/setup_monorepo.sh $(pwd)
$ . ${TESTDIR}/../../../helpers/setup.sh
$ . ${TESTDIR}/../_helpers/setup_monorepo.sh $(pwd)

Run build and record a trace
Ignore output since we want to focus on testing the generated profile
Expand Down