-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #1141
- Loading branch information
Showing
10 changed files
with
224 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// @ts-expect-error TypeScript < 4.5 doesn't support `.mjs` import | ||
import * as foo from '../foo.mjs'; | ||
|
||
test('should transform mjs files', async () => { | ||
expect(foo.pi).toBeDefined(); | ||
}); |
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 @@ | ||
const pi = 3.14 | ||
|
||
export { pi } |
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 @@ | ||
/** @type {import('ts-jest/dist/types').ProjectConfigTsJest} */ | ||
module.exports = { | ||
displayName: 'transform-mjs', | ||
globals: { | ||
'ts-jest': { | ||
tsconfig: '<rootDir>/../tsconfig.json', | ||
}, | ||
}, | ||
transform: { | ||
'^.+\\.(ts|js|mjs|html)$': '<rootDir>/../../build/index.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
49 changes: 49 additions & 0 deletions
49
src/__tests__/__snapshots__/ng-jest-transformer.spec.ts.snap
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,49 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`NgJestTransformer should process successfully a mjs file to CommonJS codes 1`] = ` | ||
Array [ | ||
" | ||
const pi = parseFloat(3.124); | ||
export { pi }; | ||
", | ||
Object { | ||
"format": "cjs", | ||
"loader": "js", | ||
"sourcemap": false, | ||
"target": "es2015", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`NgJestTransformer should process successfully a mjs file to CommonJS codes 2`] = ` | ||
Array [ | ||
" | ||
const pi = parseFloat(3.124); | ||
export { pi }; | ||
", | ||
Object { | ||
"format": "cjs", | ||
"loader": "js", | ||
"sourcemap": true, | ||
"target": "es2016", | ||
}, | ||
] | ||
`; | ||
|
||
exports[`NgJestTransformer should process successfully a mjs file to CommonJS codes 3`] = ` | ||
Array [ | ||
" | ||
const pi = parseFloat(3.124); | ||
export { pi }; | ||
", | ||
Object { | ||
"format": "cjs", | ||
"loader": "js", | ||
"sourcemap": true, | ||
"target": "es2015", | ||
}, | ||
] | ||
`; |
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
Oops, something went wrong.