-
Notifications
You must be signed in to change notification settings - Fork 367
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(testing): jest unexpected token error for @modern-js/runtime (#4070)
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 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,6 @@ | ||
--- | ||
'@modern-js/plugin-testing': patch | ||
--- | ||
|
||
fix: jest unexpected token error for @modern-js/runtime | ||
fix: 修复 Jest 对于 @modern-js/runtime 出现 unexpected token 的错误 |
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
25 changes: 25 additions & 0 deletions
25
packages/runtime/plugin-testing/tests/jestTransformEsModueRegExpStr.test.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,25 @@ | ||
import { getJestTransformEsModulesRegStr } from '../src/cli'; | ||
|
||
describe('Jest transform esModules RegExp String ', () => { | ||
const r = new RegExp(getJestTransformEsModulesRegStr()); | ||
it('In pnpm project', () => { | ||
expect(r.test('node_modules/.pnpm/@modern-js+runtime@0.0.0')).toBeFalsy(); | ||
expect(r.test('node_modules/.pnpm/@modern-js+plugin@0.0.0')).toBeFalsy(); | ||
expect( | ||
r.test('node_modules/.pnpm/@modern-js-reduck+store@0.0.0'), | ||
).toBeFalsy(); | ||
expect( | ||
r.test('node_modules/.pnpm/@modern-js-reduck+plugin-effects@0.0.0'), | ||
).toBeFalsy(); | ||
expect(r.test('node_modules/apnpm/@modern-js+runtime@0.0.0')).toBeTruthy(); | ||
expect(r.test('node_modules/.pnpm/webpack')).toBeTruthy(); | ||
}); | ||
|
||
it('In npm or yarn@1 project', () => { | ||
expect(r.test('node_modules/@modern-js/runtime')).toBeFalsy(); | ||
expect(r.test('node_modules/@modern-js/plugin')).toBeFalsy(); | ||
expect(r.test('node_modules/@modern-js-reduck/store')).toBeFalsy(); | ||
expect(r.test('node_modules/@modern-js-reduck/plugin-effects')).toBeFalsy(); | ||
expect(r.test('node_modules/webpack')).toBeTruthy(); | ||
}); | ||
}); |