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

fix(tests): improve tests and add DEVELOPMENT.md docs #111

Merged
merged 24 commits into from
Oct 23, 2024
Merged

Conversation

robertsLando
Copy link
Member

No description provided.

Copy link

@q0rban q0rban left a comment

Choose a reason for hiding this comment

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

Fantastic, thank you! This is very helpful. I'm not sure if it is just my setup, but running node test/test.js host all fails on my local with:

Error: Cannot find module '@yao-pkg/pkg-fetch/lib-es5/upload.js'

Choosing only-npm seems to bypass that error.

@robertsLando
Copy link
Member Author

@q0rban try to run yarn from root folder and try again

@robertsLando
Copy link
Member Author

@igorklopov I would like to start improving tests as right now they are very slow. I'm wondering if you have some ideas about how them could be improved, I tried looking at them but some are so big and nested especially npm related ones

@robertsLando robertsLando changed the title docs: add DEVELOPMENT.md docs fix(tests): improve tests and add DEVELOPMENT.md docs Oct 23, 2024
@igorklopov
Copy link

I think they can be parallelized. IIRC they don't overlap.

@robertsLando
Copy link
Member Author

I think they can be parallelized. IIRC they don't overlap.

I did a try on #3 without success. Will try again now once I can reach a working state :)

@robertsLando robertsLando merged commit 717b963 into main Oct 23, 2024
6 checks passed
@robertsLando robertsLando deleted the dev-docs branch October 23, 2024 15:57
@q0rban
Copy link

q0rban commented Oct 23, 2024

I think they can be parallelized. IIRC they don't overlap.

I just tested this with a Makefile, and it fails almost immediately with concurrency of 4:

# Possible values are nodeXX (e.g. node20), or "host" to use the host-installed
# node version. Defaults to "host".
TARGET ?= host

ALL_FLAVORS := $(patsubst test/%/main.js,%,$(wildcard test/**/main.js))
NO_NPM := $(filter-out test-79-npm%,$(ALL_FLAVORS))
ONLY_NPM := "test-42-fetch-all" "test-46-multi-arch" "test-46-multi-arch-2" "test-10-pnpm" "test-11-pnpm" "test-80-compression-node-opcua" "test-99-\#1135" "test-99-\#1191" "test-99-\#1192" "test-00-sea"

.PHONY: all
all: $(ALL_FLAVORS)

.PHONY: test-%
test-%:
	@if [[ -z "$(wildcard test/test-$(*)*/main.js)" ]]; then \
	  echo "Unable to find test/test-$(*)*/main.js)"; \
	  exit 1; \
	fi
	node test/test.js $(TARGET) $(@)

.PHONY: no-npm
no-npm:
	$(MAKE) $(NO_NPM)

.PHONY: only-npm
only-npm:
	$(MAKE) $(ONLY_NPM)

make --jobs 4

This fails with a complicated mess of errors ^^

However, this runs just fine:

make

@robertsLando
Copy link
Member Author

I tried to spawn tests in parallel here: #115

Seems no benefit at all, tried with different concurrency as well, they run but some are not consistent as pnpm doesn't support concurrent install, same for codesign (tests are failing almost always on macos)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants