Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuyARoss committed Sep 28, 2024
1 parent 953be42 commit d56afc5
Show file tree
Hide file tree
Showing 10 changed files with 110 additions and 110 deletions.
23 changes: 17 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# Contributing to orbit

### Finding a task
## Finding a task

Before contributing to this project, please ensure that an open issue first exists outlining that issue you plan to resolve.

### Running the project
## Running the project

To run the project, please first download the required tools.

- nodeJS >= v11
- golang 1.14

### Building the project
## Building the project

After golang is installed on your machine, you can build with `go run build`

### Running tests
You can run the tests with `make test`
## Running tests

### Requirements

- lighthouse CLI `npm i -g lighthouse`
- pytest `pip install pytest`

You can run the entire test suite with `make test` or the go tests with `make gotest` or integration tests with `make integrationtest`

## Committing code

### Committing code
This project uses the golang project standard for commit messages, you find it [here](https://go.dev/doc/contribute#commit_messages).
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ license:
gotest:
go test `go list ./... | grep -v examples`

test:
make gotest

integrationtest:
echo 'running integration tests'
make example
pytest ./scripts/test

test:
make gotest
make integrationtest

2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ var versionCMD = &cobra.Command{
Use: "version",
Short: "version",
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("version 0.21.0")
fmt.Println("version 0.21.1")
},
}
Binary file modified examples/basic-react/main
Binary file not shown.
149 changes: 60 additions & 89 deletions examples/basic-react/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ func (s *devSession) DirectFileChangeRequest(filePath string, component srcpack.

s.ChangeRequest.Push(filePath, component.BundleKey())

fmt.Println("the struct", s)
sourceMap, err := srcpack.New(s.ApplicationDir, []srcpack.PackComponent{component}, &srcpack.NewSourceMapOpts{
Parser: opts.Parser,
WebDirPath: s.ApplicationDir,
Expand Down
16 changes: 12 additions & 4 deletions internal/dev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ func TestDoChangeRequest_DirectFile(t *testing.T) {
LastFileName: "",
changeRequests: allocatedstack.New(1),
},
SessionOpts: &SessionOpts{},
SessionOpts: &SessionOpts{
BuildOpts: &BuildOpts{},
},
RootComponents: map[string]srcpack.PackComponent{
fn: comp,
},
Expand Down Expand Up @@ -121,7 +123,9 @@ func TestDoChangeRequest_IndirectFile(t *testing.T) {
LastFileName: "",
changeRequests: allocatedstack.New(1),
},
SessionOpts: &SessionOpts{},
SessionOpts: &SessionOpts{
BuildOpts: &BuildOpts{},
},
RootComponents: map[string]srcpack.PackComponent{
"thing2": comp,
},
Expand Down Expand Up @@ -189,7 +193,9 @@ func TestDoChangeRequest_UnknownPage(t *testing.T) {
LastFileName: "",
changeRequests: allocatedstack.New(1),
},
SessionOpts: &SessionOpts{},
SessionOpts: &SessionOpts{
BuildOpts: &BuildOpts{},
},
RootComponents: map[string]srcpack.PackComponent{},
SourceMap: map[string][]string{},
packer: &mockPacker{
Expand Down Expand Up @@ -239,7 +245,9 @@ func TestDoBundleChangeRequest(t *testing.T) {
LastFileName: "",
changeRequests: allocatedstack.New(1),
},
SessionOpts: &SessionOpts{},
SessionOpts: &SessionOpts{
BuildOpts: &BuildOpts{},
},
RootComponents: map[string]srcpack.PackComponent{
"test": comp,
},
Expand Down
11 changes: 8 additions & 3 deletions scripts/test/test_biproduct.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,14 @@ def path():

@pytest.fixture(autouse=True)
def orbit_run_on_example(path):
subprocess.check_output(
[f"{path}/orbit build --pacname=orbitgen --auditpage=./page.audit"], shell=True
)
try:
subprocess.check_output(
[f"{path}/orbit build --package_name=orbitgen --audit_path=./page.audit"], shell=True
)
except:
subprocess.check_output(
[f"{path}/orbit build --pacname=orbitgen --auditpage=./page.audit"], shell=True
)


def test_can_compile_autogen(path):
Expand Down
3 changes: 1 addition & 2 deletions scripts/test/utils/lighthouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
import subprocess
import json


def audits_url(endpoint):
def audits_url(endpoint):
output = subprocess.getoutput(
f'lighthouse {endpoint} --quiet --chrome-flags="--headless" --preset=desktop --output=json'
)
Expand Down
7 changes: 5 additions & 2 deletions scripts/test/utils/orbit_bindings.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ def e2e_measure_build_cmd(samples=3) -> Dict[str, int]:
for _ in range(samples):
start_time = time.time()
try:
subprocess.check_output([f"./orbit build --pacname=orbitgen"], shell=True)
except:
res = subprocess.check_output([f"./orbit build --package_name=orbitgen"], shell=True)
if b"unknown flag" in res:
res = subprocess.check_output([f"./orbit build --pacname=orbitgen"], shell=True)

except:
failure_rate += 1

end_time = time.time()
Expand Down

0 comments on commit d56afc5

Please sign in to comment.