-
Notifications
You must be signed in to change notification settings - Fork 2
refactor(scripts): add comments, remove duplicates, augment jest #263
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,4 +3,6 @@ module.exports = { | |||||
testEnvironment: 'node', | ||||||
testMatch: ['**/?(*.)+(spec|integration).ts'], | ||||||
testPathIgnorePatterns: ['/dist/'], | ||||||
// TODO: remove the following if you don't have any localstack integration tests | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was under the impression that if localstack was in use, an endpoint had to be defined - e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My comment is more to the point that this config allows including a setup file that is not just for setting up env vars for localstack, you can pretty much do anything in the setup file like, for example, create a tmp directory for all tests to output something to. |
||||||
setupFiles: ['./jest.setup.js'], | ||||||
}; |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,4 @@ | ||||||||
// your AWS_ENDPOINT values should be set in .docker/local.env | ||||||||
// this file is to provide a value when running tests locally outside of the container | ||||||||
// TODO: if you don't have any localstack integration tests, you can delete this file | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
process.env.AWS_ENDPOINT = process.env.AWS_ENDPOINT || 'http://localhost:4566'; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -4,6 +4,10 @@ export default { | |||||
environment: process.env.NODE_ENV || 'development', | ||||||
defaultMaxAge: 86400, | ||||||
}, | ||||||
// TODO: if you aren't using localstack, you can get rid of the `aws` section | ||||||
aws: { | ||||||
localEndpoint: process.env.AWS_ENDPOINT, | ||||||
} | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// TODO: Update example cache configuration below if necessary. | ||||||
redis: { | ||||||
primaryEndpoint: process.env.REDIS_PRIMARY_ENDPOINT || 'redis', | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you explain this a bit more? in this instance does "CircleCI" mean a server (not a container) within circle's infrastructure that talks to our specified containers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpetto From my understanding, when a job is triggered on Circle CI, it provisions a VM (think your local machine) and runs the containers, exposing them on
localhost
.Before we run integration tests we export the environment variables that our application depends on to the shell. This means that when tests are running and using configurations from our
config/index.ts
file (which pulls from these env vars), what it reads are the env var definitions for the docker container. CircleCI does not know whatmysql
means, so we tell CircleCI that when you seemysql
, please look at it aslocalhost
or127.0.0.1
.Now you may be asking, just as I'm asking myself now, that with projects like prospect-api that are set up to run outside the container without needing any of these env vars, why do we export anything to the shell? I think the answer is that we don't need to and CIrcleCI should just work. I will confirm this after these short messages :)
Let me know if a live chat might help a bit more here.