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

refactor: use sandbox.path instead of SANDBOX to access the sandbox directory #5014

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

raymondfeng
Copy link
Contributor

@raymondfeng raymondfeng commented Apr 2, 2020

Step 1 for #5011

Refactor test sandbox usage to use sandbox.path to access the sandbox directory as we'll create unique subdirs for different sandbox instances.

Checklist

👉 Read and sign the CLA (Contributor License Agreement) 👈

  • npm test passes on your machine
  • New tests added or existing tests modified to cover all changes
  • Code conforms with the style guide
  • API Documentation in code was updated
  • Documentation in /docs/site was updated
  • Affected artifact templates in packages/cli were updated
  • Affected example projects in examples/* were updated

👉 Check out how to submit a PR 👈

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Cross-posting from #5016 (review):

I love the idea of changing the code to use sandbox.path. Considering that SANDBOX_PATH should not be used any more, I think our code would be much less error-prone if the constant was removed completely.

Now:

const SANDBOX_PATH = path.resolve(__dirname, '../.sandbox');
const sandbox = new TestSandbox(SANDBOX_PATH);

My proposal:

const sandbox = new TestSandbox(path.resolve(__dirname, '../.sandbox'));

@raymondfeng
Copy link
Contributor Author

@bajtos The SANDBOX constants are removed.

@raymondfeng raymondfeng requested a review from bajtos April 2, 2020 21:26
@dhmlau dhmlau added this to the April 2020 milestone Apr 2, 2020
@raymondfeng raymondfeng added the Testlab @loopback/testlab label Apr 2, 2020
@raymondfeng raymondfeng force-pushed the refine-test-sandbox-usage branch 2 times, most recently from 6d9ff7a to d67658a Compare April 2, 2020 23:16
Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Thank you for removing SANDBOX constants 👏 The pull request is almost ready now 🏁

examples/file-transfer/src/application.ts Outdated Show resolved Hide resolved
@bajtos bajtos added the refactor label Apr 3, 2020
…irectory

The starting path for a sandbox is not necessarily the target directory as
we may create a unique subdir under the path to ensure sandboxes can be used
in parallel testing.
@raymondfeng raymondfeng merged commit 56a4696 into master Apr 3, 2020
@raymondfeng raymondfeng deleted the refine-test-sandbox-usage branch April 3, 2020 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Testlab @loopback/testlab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants