Skip to content

Commit 32cc9f2

Browse files
vvaibhavdesaisahsisunnyRitikJaiswal75
authored
ts- testing (#1330)
* ts- testing * test: recursive search for test on linux dist * TEST: add js in mocharc extension * feat: idk what i did here * empty * add prettier fix * run lint fix * feat: this is annoying --------- Co-authored-by: Sunny Sahsi <[email protected]> Co-authored-by: ritikjaiswal75 <[email protected]>
1 parent 5c00318 commit 32cc9f2

File tree

16 files changed

+1155
-773
lines changed

16 files changed

+1155
-773
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ module.exports = {
3030
// Prettier for formatting
3131
"prettier/prettier": "error",
3232
},
33-
ignorePatterns: ["public/*"],
33+
ignorePatterns: ["public/*", "dist/*"],
3434
};

.github/workflows/codeql.yml

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ name: "CodeQL"
1313

1414
on:
1515
push:
16-
branches: [ "develop", main ]
16+
branches: ["develop", main]
1717
pull_request:
1818
# The branches below must be a subset of the branches above
19-
branches: [ "develop" ]
19+
branches: ["develop"]
2020
schedule:
21-
- cron: '15 19 * * 5'
21+
- cron: "15 19 * * 5"
2222

2323
jobs:
2424
analyze:
@@ -32,43 +32,42 @@ jobs:
3232
strategy:
3333
fail-fast: false
3434
matrix:
35-
language: [ 'javascript' ]
35+
language: ["javascript"]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
3737
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3838

3939
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v3
40+
- name: Checkout repository
41+
uses: actions/checkout@v3
4242

43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
52-
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53-
# queries: security-extended,security-and-quality
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v2
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
5451

55-
56-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
57-
# If this step fails, then you should remove it and run the build manually (see below)
58-
- name: Autobuild
59-
uses: github/codeql-action/autobuild@v2
52+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
53+
# queries: security-extended,security-and-quality
6054

61-
# ℹ️ Command-line programs to run using the OS shell.
62-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
55+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
56+
# If this step fails, then you should remove it and run the build manually (see below)
57+
- name: Autobuild
58+
uses: github/codeql-action/autobuild@v2
6359

64-
# If the Autobuild fails above, remove it and uncomment the following three lines.
65-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
60+
# ℹ️ Command-line programs to run using the OS shell.
61+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
6662

67-
# - run: |
68-
# echo "Run, Build Application using script"
69-
# ./location_of_script_within_repo/buildscript.sh
63+
# If the Autobuild fails above, remove it and uncomment the following three lines.
64+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
7065

71-
- name: Perform CodeQL Analysis
72-
uses: github/codeql-action/analyze@v2
73-
with:
74-
category: "/language:${{matrix.language}}"
66+
# - run: |
67+
# echo "Run, Build Application using script"
68+
# ./location_of_script_within_repo/buildscript.sh
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v2
72+
with:
73+
category: "/language:${{matrix.language}}"

.github/workflows/test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
node-version: [18.x]
1919

2020
steps:
21-
- uses: actions/checkout@v3
22-
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v3
24-
with:
25-
node-version: ${{ matrix.node-version }}
26-
- run: yarn
27-
- run: yarn test
21+
- uses: actions/checkout@v3
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/setup-node@v3
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- run: yarn
27+
- run: yarn test

.mocharc.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@
33
* Info: https://mochajs.org/#configuring-mocha-nodejs
44
*/
55
module.exports = {
6-
timeout: '5000',
6+
timeout: "5000",
7+
extension: ["ts", "js"],
8+
require: "ts-node/register",
79
};

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Real Dev Squad API Changelog
2+
23
All notable changes to this project will be documented in this file.
34

45
<!--
@@ -11,12 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1112
<!-- Sample changelog
1213
## [Project Version] - YYYY-MM-DD
1314
14-
### Added
15+
### Added
1516
- Feature name added
1617
1718
### Changed
18-
### Deprecated
19+
### Deprecated
1920
### Removed
20-
### Fixed
21+
### Fixed
2122
### Security
2223
-->

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ yarn validate-setup
5454

5555
Head over to [TDD Tests Files List](scripts/tests/tdd-files-list.txt), and add the list of your new (or old) test files.
5656

57-
> You can use wildcard '*' in the filepaths
57+
> You can use wildcard '\*' in the filepaths
5858
5959
Run TDD in watch mode. Exiting this command will print the coverage report. Try to achieve 100% coverage.
6060

docs/backendFlow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ Tests are written using:
242242
- `scripts` : For different scripts needed for development & others
243243
- `Dependencies` : Modules needed for the project to work/ be functional
244244
- `devDependencies` : Dependencies only needed for the devlopment purpose
245-
245+
246246
<br>
247247

248248
---

package.json

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
"version": "1.0.0",
44
"private": true,
55
"scripts": {
6-
"start": "node server.js",
7-
"dev": "cross-env NODE_ENV=development nodemon server.js",
6+
"start": "node ./dist/server.js",
7+
"tsc": "tsc",
8+
"postinstall": "yarn run tsc",
9+
"dev": "cross-env NODE_ENV=development ts-node-dev server.js",
810
"lint": "eslint .",
911
"lint-fix": "eslint . --fix",
1012
"validate-setup": "node scripts/validateSetup.js",
@@ -38,7 +40,13 @@
3840
"winston": "^3.3.3"
3941
},
4042
"devDependencies": {
41-
"chai": "^4.3.4",
43+
"@types/chai": "^4.3.5",
44+
"@types/express": "^4.17.17",
45+
"@types/jest": "^29.5.3",
46+
"@types/mocha": "^10.0.1",
47+
"@types/node": "^20.4.3",
48+
"@typescript-eslint/parser": "^6.1.0",
49+
"chai": "^4.3.7",
4250
"chai-http": "^4.3.0",
4351
"cross-env": "^7.0.3",
4452
"eslint": "^8.0.0",
@@ -52,13 +60,16 @@
5260
"eslint-plugin-security": "^1.4.0",
5361
"eslint-plugin-standard": "^4.1.0",
5462
"firebase-tools": "^11.28.0",
55-
"mocha": "^10.0.0",
63+
"mocha": "^10.2.0",
5664
"nock": "^13.0.11",
5765
"nodemon": "^2.0.7",
5866
"nyc": "^15.1.0",
5967
"pre-commit": "^1.2.2",
6068
"prettier": "^2.5.1",
61-
"sinon": "^15.0.0"
69+
"sinon": "^15.0.0",
70+
"ts-node": "^10.9.1",
71+
"ts-node-dev": "^2.0.0",
72+
"typescript": "^5.1.6"
6273
},
6374
"engines": {
6475
"node": "18.x"

renovate.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3-
"extends": [
4-
"config:base"
5-
]
3+
"extends": ["config:base"]
64
}

scripts/tests/tdd.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export NODE_ENV='test'
1818
echo '\nStart firestore emulator and run tests during TDD only:\n'
1919

2020
# Read config meanings here: https://github.com/istanbuljs/nyc#common-configuration-options
21-
firebase emulators:exec "nyc --check-coverage=true --all=false --skip-full=true --per-file=true mocha --watch $allPaths"
21+
firebase emulators:exec "nyc --check-coverage=true --all=false --skip-full=true --recursive --per-file=true mocha --watch $allPaths"
2222

2323
# Aim to achieve these results when you exit:
2424
# =============================== Coverage summary ===============================

0 commit comments

Comments
 (0)