-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(plugin-testing): failed to run tests with decorators (#4840)
- Loading branch information
1 parent
0b9e483
commit 6e8cb66
Showing
12 changed files
with
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@modern-js/builder-webpack-provider': patch | ||
'@modern-js/plugin-testing': patch | ||
--- | ||
|
||
fix(plugin-testing): failed to run tests with decorators | ||
|
||
fix(plugin-testing): 修复无法运行带有 decorator 的测试用例的问题 |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 @@ | ||
import { testingPlugin } from '@modern-js/plugin-testing'; | ||
import { applyBaseConfig } from '../../utils/applyBaseConfig'; | ||
|
||
export default applyBaseConfig({ | ||
plugins: [testingPlugin()], | ||
}); |
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,14 @@ | ||
{ | ||
"private": true, | ||
"name": "@e2e/testing-plugin", | ||
"version": "1.0.0", | ||
"scripts": { | ||
"test": "modern test" | ||
}, | ||
"devDependencies": { | ||
"@modern-js/app-tools": "workspace:*", | ||
"@modern-js/plugin-testing": "workspace:*", | ||
"@types/jest": "^29", | ||
"@types/node": "^14" | ||
} | ||
} |
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,10 @@ | ||
function seal(constructor: unknown) { | ||
Object.seal(constructor); | ||
} | ||
|
||
@seal | ||
export class DummyClass { | ||
public method() { | ||
// Method implementation | ||
} | ||
} |
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,7 @@ | ||
import { DummyClass } from '../src'; | ||
|
||
describe('basic test', () => { | ||
test('should compile legacy decorator correctly', () => { | ||
expect(new DummyClass()).toEqual({}); | ||
}); | ||
}); |
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,12 @@ | ||
{ | ||
"extends": "@modern-js/tsconfig/base", | ||
"compilerOptions": { | ||
"declaration": true, | ||
"jsx": "preserve", | ||
"baseUrl": "./", | ||
"emitDeclarationOnly": true, | ||
"isolatedModules": true, | ||
"paths": {}, | ||
"types": ["node", "jest"] | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "@modern-js/tsconfig/base", | ||
"compilerOptions": { | ||
"declaration": false, | ||
"jsx": "preserve", | ||
"baseUrl": "./", | ||
"paths": { | ||
"@/*": ["./src/*"] | ||
}, | ||
"target": "ES5", | ||
"experimentalDecorators": true, | ||
"types": ["jest"] | ||
}, | ||
"include": ["src"] | ||
} |