awslabs / amplify-video

An open source Category Plugin for the AWS Amplify-CLI that makes it easy to deploy live and file based streaming video services and integrate them into your Amplify applications.
https://www.npmjs.com/package/amplify-category-video
Apache License 2.0
267 stars 56 forks source link

Create a development testing environment #193

Open nathanagez opened 3 years ago

nathanagez commented 3 years ago

Is your feature request related to a problem? Please describe. The new testing workflow triggers some scripts to provide and delete resources in the cloud each time we run the tests. It can be time consuming when we are waiting for this pipeline to run during development phases.

Describe the solution you'd like A good solution should be to create a specific workflow that we can run when we are in development mode that allow the user to use an existing amplify project (locally) to run his tests instead.

Suggestions:

package.json

{
"scripts": {
    "postinstall": "node scripts/post-install.js",
    "test": "jest --detectOpenHandles --runInBand",
    "dev-test": "NODE_ENV=dev jest --detectOpenHandles --runInBand",
    "lint": "eslint .",
    "lint-fix": "eslint . --fix"
  },
}

jest.config.js

module.exports = {
  verbose: true,
  globalSetup: './scripts/setup.js',
  globalTeardown: process.env.NODE_ENV === 'test' ? './scripts/teardown.js' : null, // Jest automatically set NODE_ENV to test if it's not already set to something else.
};