-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb93d53
commit 6b86f2c
Showing
8 changed files
with
80 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,15 @@ jobs: | |
with: | ||
go-version: '>=1.20.0' | ||
|
||
{%- if cookiecutter.type == "svelte" %} | ||
- name: Set up JS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: lts/* | ||
cache: "npm" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
{%- endif %} | ||
|
||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
js/{{ cookiecutter.project_name }}/nestjs/test/app.e2e-spec.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
js/{{ cookiecutter.project_name }}/nestjs/test/health.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import * as supertest from 'supertest'; | ||
import { request } from './setup'; | ||
|
||
describe('HealthController (e2e)', () => { | ||
let app: supertest.Test; | ||
|
||
describe('/', () => { | ||
describe('GET', () => { | ||
beforeEach(async () => { | ||
app = (await request())().get('/health'); | ||
}); | ||
|
||
it('should return a healthy state', () => app.expect(200)); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
process.env.LOG_LEVEL = 'silent'; | ||
|
||
import { INestApplication } from '@nestjs/common'; | ||
import { Test, TestingModule } from '@nestjs/testing'; | ||
import * as supertest from 'supertest'; | ||
import { AppModule } from '../src/app.module'; | ||
|
||
let app: INestApplication; | ||
|
||
export const destroyApp = async () => { | ||
if (app) { | ||
await app.close(); | ||
|
||
/* Remove definition to prevent being run again */ | ||
app = undefined; | ||
} | ||
}; | ||
|
||
export const request = async (): Promise< | ||
() => supertest.SuperTest<supertest.Test> | ||
> => { | ||
const moduleFixture: TestingModule = await Test.createTestingModule({ | ||
imports: [AppModule], | ||
}).compile(); | ||
|
||
app = moduleFixture.createNestApplication(); | ||
await app.init(); | ||
|
||
return () => supertest(app.getHttpServer()); | ||
}; | ||
|
||
export { supertest }; | ||
|
||
// Ensure that the test app is correctly destroyed after use | ||
afterEach(() => destroyApp()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
{ | ||
"extends": "./.svelte-kit/tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true | ||
} | ||
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias | ||
// | ||
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes | ||
// from the referenced tsconfig.json - TypeScript does not merge them in | ||
"extends": "./.svelte-kit/tsconfig.json", | ||
"compilerOptions": { | ||
"allowJs": true, | ||
"checkJs": true, | ||
"esModuleInterop": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"strict": true | ||
} | ||
} |