Skip to content

Commit

Permalink
Move Turborepo integration tests to their own workspace (#4617)
Browse files Browse the repository at this point in the history
This enables us to remove the bespoke turbo task to run these
tests, and also reduces our dependency on Makefile. Further,
we can extract the helpers into their own workspace after this and
use them for examples_tests so we can wire up dependencies even
more accurately The Turbo Way.
  • Loading branch information
mehulkar committed Apr 18, 2023
1 parent 10a2df4 commit a24301d
Show file tree
Hide file tree
Showing 464 changed files with 82 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
key: prysk-venv-${{ matrix.os.name }}

- name: Integration Tests
run: pnpm -- turbo run integration-tests --filter=cli
run: pnpm test -- --filter=turborepo-integration-tests
env:
GO_TAG: rust

Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ On macOS: `brew install sponge jq zstd`
From the root directory, you can

- run unit tests with `pnpm run --filter=cli test`
- run integration tests with `pnpm run --filter=cli integration-tests`
- run integration tests with `pnpm test -- --filter=turborepo-tests`
- run e2e tests with `pnpm run --filter=cli e2e`

To run a single Go test, you can run `go test ./[path/to/package/]`. See more [in the Go docs](https://pkg.go.dev/cmd/go#hdr-Test_packages).
Expand Down
23 changes: 0 additions & 23 deletions cli/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -321,29 +321,6 @@ clean-demo:
rm -rf node_modules
rm -rf demo

CRAM_ENV := .cram_env

$(CRAM_ENV)/bin/pip:
python3 -m venv $(CRAM_ENV)
.cram_env/bin/python3 -m pip install --quiet --upgrade pip

$(CRAM_ENV)/bin/prysk: $(CRAM_ENV)/bin/pip
$(CRAM_ENV)/bin/pip install prysk

$(CRAM_ENV)/bin/pytest: $(CRAM_ENV)/bin/pip
$(CRAM_ENV)/bin/pip3 install --quiet pytest "prysk[pytest-plugin]" pytest-xdist

INTEGRATION_TEST_FILES = $(shell find integration_tests -name "*.t")

integration-tests-serial: $(CRAM_ENV)/bin/prysk turbo $(INTEGRATION_TEST_FILES) corepack turbo
$(CRAM_ENV)/bin/prysk --shell=`which bash` $(INTEGRATION_TEST_FILES)

integration-tests: $(CRAM_ENV)/bin/prysk $(CRAM_ENV)/bin/pytest turbo $(INTEGRATION_TEST_FILES) corepack turbo
$(CRAM_ENV)/bin/pytest -n auto $(INTEGRATION_TEST_FILES) --prysk-shell=`which bash`

integration-tests-interactive: $(CRAM_ENV)/bin/prysk turbo $(INTEGRATION_TEST_FILES) corepack turbo
$(CRAM_ENV)/bin/prysk --shell=`which bash` -i $(INTEGRATION_TEST_FILES)

# use target fixture-<some directory under integration_tests/_fixtures> to set up the testbed directory
.PHONY=fixture-%
fixture-%:
Expand Down
8 changes: 0 additions & 8 deletions cli/integration_tests/_helpers/setup.sh

This file was deleted.

3 changes: 1 addition & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"e2e": "make e2e",
"e2e-prebuilt": "make e2e-prebuilt",
"format": "make fmt-go",
"lint": "make lint-go",
"integration-tests": "make integration-tests-serial"
"lint": "make lint-go"
},
"devDependencies": {
"copy-template-dir": "^1.4.0",
Expand Down
4 changes: 0 additions & 4 deletions cli/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
},
"e2e-prebuilt": {
"inputs": ["**/*.go", "go.mod", "go.sum", "scripts/e2e/e2e.ts"]
},
"integration-tests": {
"inputs": ["integration_tests/**"],
"env": ["GO_TAG"]
}
}
}
2 changes: 1 addition & 1 deletion examples_tests/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ fi

# Delete .git directory if it's there, we'll set up a new git repo
[ ! -d .git ] || rm -rf .git
"${SCRIPT_DIR}/../cli/integration_tests/_helpers/setup_git.sh" "${TARGET_DIR}"
"${SCRIPT_DIR}/../turborepo-tests/integration/tests/_helpers/setup_git.sh" "${TARGET_DIR}"
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"turbo-prebuilt": "node turbow.js",
"docs": "pnpm -- turbo run dev --filter=docs --no-cache",
"run-example": "./scripts/run-example.sh",
"prepare": "husky install"
"prepare": "husky install",
"test": "pnpm -- turbo run test"
},
"devDependencies": {
"@taplo/cli": "^0.5.2",
Expand Down
1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ packages:
- "cli"
- "packages/*"
- "benchmark"
- "turborepo-tests/integration"
# Intentionally exclude the `npm` `turbo` package from the workspaces.
- "!packages/turbo"
- "packages/turbo-tracing-next-plugin/test/with-mongodb-mongoose"
Expand Down
File renamed without changes.
12 changes: 12 additions & 0 deletions turborepo-tests/integration/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "turborepo-integration-tests",
"scripts": {
"test:setup_python": "python3 -m venv .cram_env",
"test:setup_pip": "pnpm test:setup_python && .cram_env/bin/python3 -m pip install --quiet --upgrade pip",
"test:setup_prysk": "pnpm test:setup_pip && .cram_env/bin/pip install prysk",
"test": "pnpm test:setup_prysk && .cram_env/bin/prysk --shell=`which bash` tests/**/*.t",
"test:interactive": ".cram_env/bin/prysk -i --shell=`which bash` tests/**/*.t",
"test:parallel": ".cram_env/bin/pytest -n auto tests/**/*.t --prysk-shell=`which bash`",
"pretest:parallel": ".cram_env/bin/pip3 install --quiet pytest \"prysk[pytest-plugin]\" pytest-xdist"
}
}
Loading

1 comment on commit a24301d

@vercel
Copy link

@vercel vercel bot commented on a24301d Apr 18, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.