-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support static file copy (#608)
- Loading branch information
Showing
10 changed files
with
124 additions
and
28 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
Empty file.
1 change: 1 addition & 0 deletions
1
packages/faas-cli-plugin-invoke/test/fixtures/baseApp/src/view/a.html
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 @@ | ||
<div>a</div> |
1 change: 1 addition & 0 deletions
1
packages/faas-cli-plugin-invoke/test/fixtures/baseApp/src/view/b.json
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 @@ | ||
{} |
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,28 @@ | ||
import { invoke } from '../src/index'; | ||
import { join } from 'path'; | ||
import * as assert from 'assert'; | ||
import { pathExists, remove, existsSync } from 'fs-extra'; | ||
|
||
describe('/test/static-files.test.ts', () => { | ||
beforeEach(async () => { | ||
const dirs = [join(__dirname, './fixtures/baseApp')]; | ||
for (const dir of dirs) { | ||
if (await pathExists(join(dir, '.faas_debug_tmp'))) { | ||
await remove(join(dir, '.faas_debug_tmp')); | ||
} | ||
} | ||
}); | ||
it('invoke', async () => { | ||
const dir = join(__dirname, 'fixtures/baseApp'); | ||
const dist = join(dir, '.faas_debug_tmp/dist'); | ||
const result: any = await (invoke as any)({ | ||
functionDir: dir, | ||
functionName: 'http', | ||
clean: false, | ||
}); | ||
assert(result.body === 'hello http world'); | ||
assert(existsSync(join(dist, 'a.txt'))); | ||
assert(existsSync(join(dist, 'view/a.html'))); | ||
assert(existsSync(join(dist, 'view/b.json'))); | ||
}); | ||
}); |
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
Empty file.
Empty file.
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