-
Notifications
You must be signed in to change notification settings - Fork 35
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
Showing
5 changed files
with
79 additions
and
7 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import mm from 'egg-mock'; | ||
import assert from 'assert'; | ||
import path from 'path'; | ||
|
||
describe('test/DuplicateOptionalModule.test.ts', () => { | ||
let app; | ||
const fixturesPath = path.join(__dirname, './fixtures/apps/duplicate-optional-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: fixturesPath, | ||
framework: require.resolve('egg'), | ||
}); | ||
await app.ready(); | ||
}); | ||
|
||
it('should work', async () => { | ||
assert.equal(app.moduleReferences.length, 2); | ||
}); | ||
}); |
20 changes: 20 additions & 0 deletions
20
plugin/config/test/fixtures/apps/duplicate-optional-module/config/config.default.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,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; | ||
}; |
8 changes: 8 additions & 0 deletions
8
plugin/config/test/fixtures/apps/duplicate-optional-module/config/plugin.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,8 @@ | ||
'use strict'; | ||
|
||
exports.tracer = { | ||
package: 'egg-tracer', | ||
enable: true, | ||
}; | ||
|
||
exports.watcher = false; |
9 changes: 9 additions & 0 deletions
9
plugin/config/test/fixtures/apps/duplicate-optional-module/package.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,9 @@ | ||
{ | ||
"name": "egg-app", | ||
"egg": { | ||
"framework": "foo" | ||
}, | ||
"dependencies": { | ||
"used": "*" | ||
} | ||
} |