-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import mm from 'egg-mock'; | ||
import assert from 'assert'; | ||
import path from 'path'; | ||
import { UsedProto } from './fixtures/apps/plugin-module/node_modules/foo-plugin/Used'; | ||
|
||
describe.only('test/OptionalPluginModule.test.ts', () => { | ||
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-ubuntu (20)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-ubuntu (18)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-ubuntu (16)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-windows (20)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-ubuntu (14)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-macos (16)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-windows (18)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-windows (16)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-windows (14)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-macos (18)
Check warning on line 6 in plugin/tegg/test/OptionalPluginModule.test.ts GitHub Actions / Runner-macos (14)
|
||
let app; | ||
const fixtureDir = path.join(__dirname, 'fixtures/apps/plugin-module'); | ||
|
||
after(async () => { | ||
await app.close(); | ||
}); | ||
|
||
afterEach(() => { | ||
mm.restore(); | ||
}); | ||
|
||
before(async () => { | ||
mm(process.env, 'EGG_TYPESCRIPT', true); | ||
mm(process, 'cwd', () => { | ||
return path.join(__dirname, '..'); | ||
}); | ||
app = mm.app({ | ||
baseDir: fixtureDir, | ||
framework: require.resolve('egg'), | ||
}); | ||
await app.ready(); | ||
}); | ||
|
||
it('should work', async () => { | ||
await app.mockModuleContextScope(async ctx => { | ||
const usedProto = await ctx.getEggObject(UsedProto); | ||
assert(usedProto); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
module.exports = function(appInfo) { | ||
const config = { | ||
keys: 'test key', | ||
customLogger: { | ||
xxLogger: { | ||
file: path.join(appInfo.root, 'logs/xx.log'), | ||
}, | ||
}, | ||
security: { | ||
csrf: { | ||
ignoreJSON: false, | ||
} | ||
}, | ||
}; | ||
return config; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
exports.tracer = { | ||
package: 'egg-tracer', | ||
enable: true, | ||
}; | ||
|
||
exports.teggConfig = { | ||
package: '@eggjs/tegg-config', | ||
enable: true, | ||
}; | ||
|
||
exports.eggFooPlugin = { | ||
package: 'foo-plugin', | ||
enable: true, | ||
}; | ||
|
||
exports.watcher = false; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "egg-app", | ||
"egg": { | ||
"framework": "foo" | ||
} | ||
} |