-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate faas test to new cli (#61)
* chore: migrate faas test to new cli * chore: update mjs * chore: update mwts * fix: cjs
- Loading branch information
1 parent
a2eae0a
commit ab28fa4
Showing
20 changed files
with
63 additions
and
53 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
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,5 +1,6 @@ | ||
{ | ||
"extension": ["ts"], | ||
"node-option": ["no-warnings", "loader=ts-node/esm"], | ||
"spec": ["test/**/*.test.ts"] | ||
"spec": ["test/**/*.test.ts"], | ||
"require": ["test/setup.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
2 changes: 1 addition & 1 deletion
2
v3/midway-framework-koa-esm/boilerplate/test/controller/api.test.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
2 changes: 1 addition & 1 deletion
2
v3/midway-framework-koa-esm/boilerplate/test/controller/home.test.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
File renamed without changes.
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
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,5 +1,6 @@ | ||
{ | ||
"extension": ["ts"], | ||
"node-option": ["no-warnings", "loader=ts-node/esm"], | ||
"spec": ["test/**/*.test.ts"] | ||
"spec": ["test/**/*.test.ts"], | ||
"require": ["test/setup.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
2 changes: 1 addition & 1 deletion
2
v3/midway-serverless-http-new-esm/boilerplate/test/hello.test.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
File renamed without changes.
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,7 +1,7 @@ | ||
{ | ||
"extends": "./node_modules/mwts/", | ||
"ignorePatterns": ["node_modules", "dist", "test", "jest.config.js", "typings"], | ||
"ignorePatterns": ["node_modules", "dist", "test", "typings"], | ||
"env": { | ||
"jest": true | ||
"mocha": true | ||
} | ||
} |
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,6 @@ | ||
{ | ||
"extension": ["ts"], | ||
"node-option": ["no-warnings", "loader=ts-node/register"], | ||
"spec": ["test/**/*.test.ts"], | ||
"require": ["test/setup.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
This file was deleted.
Oops, something went wrong.
20 changes: 6 additions & 14 deletions
20
v3/midway-serverless-http-new/boilerplate/test/hello.test.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 |
---|---|---|
@@ -1,23 +1,15 @@ | ||
import { createFunctionApp, close, createHttpRequest } from '@midwayjs/mock'; | ||
import { Application, Framework } from '@midwayjs/faas'; | ||
import { createHttpRequest } from '@midwayjs/mock'; | ||
import { Application } from '@midwayjs/faas'; | ||
import { getApp } from './setup'; | ||
import * as assert from 'assert'; | ||
|
||
describe('test/index.test.ts', () => { | ||
|
||
let app: Application; | ||
|
||
beforeAll(async () => { | ||
// create app | ||
app = await createFunctionApp<Framework>(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await close(app); | ||
}); | ||
|
||
it('should get result from http trigger', async () => { | ||
const app: Application = getApp(); | ||
const result = await createHttpRequest(app).get('/').query({ | ||
name: 'Midway.js' | ||
}) | ||
expect(result.text).toEqual('Hello Midway.js'); | ||
assert(result.text === 'Hello Midway.js'); | ||
}); | ||
}); |
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,15 @@ | ||
import { createFunctionApp, close } from '@midwayjs/mock'; | ||
|
||
let app; | ||
export async function mochaGlobalSetup() { | ||
// create app | ||
app = await createFunctionApp(); | ||
} | ||
|
||
export async function mochaGlobalTeardown() { | ||
await close(app); | ||
}; | ||
|
||
export function getApp() { | ||
return app; | ||
} |