Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: missing import component will be throw error (#1694)
- Loading branch information
1 parent
89a0300
commit c17f049
Showing
12 changed files
with
98 additions
and
11 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
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,21 @@ | ||
import { createLightFramework } from './util'; | ||
import { join } from 'path'; | ||
import { MidwayMissingImportComponentError } from '../src'; | ||
|
||
describe('/test/feature.test.ts', () => { | ||
it('should throw error when inject', async () => { | ||
let err; | ||
try { | ||
await createLightFramework(join( | ||
__dirname, | ||
'./fixtures/base-app-not-import-throw-error/src' | ||
)); | ||
} catch (error) { | ||
err = error; | ||
} | ||
expect(err).toBeDefined(); | ||
expect(() => { | ||
throw err; | ||
}).toThrowError(MidwayMissingImportComponentError); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/core/test/fixtures/base-app-not-import-throw-error/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,3 @@ | ||
{ | ||
"name": "ali-demo" | ||
} |
16 changes: 16 additions & 0 deletions
16
packages/core/test/fixtures/base-app-not-import-throw-error/src/configuration.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 { Configuration, Inject } from '@midwayjs/decorator'; | ||
// import * as book from 'midway-test-component'; | ||
import { BookService } from 'midway-test-component'; | ||
|
||
@Configuration({ | ||
imports: [], | ||
}) | ||
export class ContainerLifeCycle { | ||
|
||
@Inject() | ||
bookService: BookService; | ||
|
||
async onReady() { | ||
console.log('[ Midway ] onReady', this.bookService); | ||
} | ||
} |
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
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