Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove docos
  • Loading branch information
dblythy committed Jan 21, 2025
commit 433de4a389a5eb6228a6fd6db2e70059d9c1b77b
26 changes: 4 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ jobs:
- name: Check Linting
run: npm run lint

unit-tests:
tests:
runs-on: ubuntu-latest
name: Unit Tests
name: Tests
steps:
- name: Fix usage of insecure GitHub protocol
run: sudo git config --system url."https://github".insteadOf "git://github"
Expand All @@ -39,26 +39,8 @@ jobs:
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Unit Tests
run: npm run test:unit

e2e-tests:
runs-on: ubuntu-latest
name: End-to-End Tests
steps:
- name: Fix usage of insecure GitHub protocol
run: sudo git config --system url."https://github".insteadOf "git://github"
- uses: actions/checkout@v3
- name: Use Node.js 22
uses: actions/setup-node@v3
with:
node-version: 22
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run e2e Tests
run: npm run test:e2e

- name: Run Tests
run: npm test
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
3 changes: 1 addition & 2 deletions .nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"text-summary"
],
"exclude": [
"**/e2e/**",
"**/tests/**"
"**/spec/**"
]
}

30 changes: 0 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,9 @@ These scripts can help you to develop your app for Parse Server:
* `npm run lint` will check the linting of your cloud code, tests and `index.js`, as defined in `.eslintrc.json`.
* `npm run lint-fix` will attempt fix the linting of your cloud code, tests and `index.js`.
* `npm run prettier` will help improve the formatting and layout of your cloud code, tests and `index.js`, as defined in `.prettierrc`.
* `npm run test:e2e` will run any e2e tests that are written in `/e2e`.
* `npm run test:unit` will run any unit tests that are written in `tests`
* `npm test` will run all tests
* `npm run coverage` will run tests and check coverage. Output is available in the `/coverage` folder.

## Testing

Effective testing is crucial for maintaining the stability and reliability of your application. The testing pyramid is a widely adopted strategy to balance different types of tests and ensure a robust testing process.

### Testing Pyramid
The testing pyramid emphasizes the following layers:

1. Unit Tests:
- Focus on testing individual functions or components in isolation.
- Fast, reliable, and provide detailed feedback on specific parts of your code.
- Recommended to have a large amount of unit tests that test small units of code
- These tests should use mocks to simulate dependencies, eliminating the need for the entire system to be operational.
- Example: Testing a utility function or a cloud function independently.
- Command: `npm run test:unit`

2. Integration Tests:
- Validate that different modules or components work together correctly.
- Useful for testing database interactions, API endpoints, or cloud function workflows.
- Recommended to have a medium amount of integration tests that test the integration of units.
- Typically slower than unit tests but cover a broader scope.

3. End-to-End (E2E) Tests:
- Test the application as a whole, simulating real user interactions.
- Validate that the entire system works as expected, from the user interface to the backend.
- Recommmended to have a small amount of e2e tests.
- Example: Testing user login or data submission flows.
- Command: `npm run test:e2e`

## Configuration

Configuration is located in `config.js`.
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"main": "index.js",
"scripts": {
"coverage": "nyc --reporter=html --reporter=text npm test",
"lint": "eslint --cache ./cloud && eslint --cache index.js && eslint --cache ./e2e",
"lint-fix": "eslint --cache --fix ./cloud && eslint --cache --fix index.js && eslint --cache --fix ./e2e",
"prettier": "prettier --write '{cloud,e2e}/{**/*,*}.js' 'index.js'",
"lint": "eslint --cache ./cloud && eslint --cache index.js && eslint --cache ./spec",
"lint-fix": "eslint --cache --fix ./cloud && eslint --cache --fix index.js && eslint --cache --fix ./spec",
"prettier": "prettier --write '{cloud,spec}/{**/*,*}.js' 'index.js'",
"start": "node index.js",
"pretest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=7.0.1} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} mongodb-runner start -t ${MONGODB_TOPOLOGY} --version ${MONGODB_VERSION} -- --port 27017",
"test": "TESTING=true jasmine",
"posttest:e2e": "mongodb-runner stop --all",
"posttest": "mongodb-runner stop --all",
"watch": "nodemon index.js"
},
"dependencies": {
Expand Down
2 changes: 0 additions & 2 deletions spec/Tests.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// E2E tests should be minimal and only test the integration of the Parse Server.
// Unit tests are preferred as they are faster and more reliable, and do not require a running Parse Server.
describe('Parse Server example', () => {
Parse.User.enableUnsafeCurrentUser();
it('call function', async () => {
Expand Down
Loading