parent
13c5019ac9
commit
a30aac5668
|
|
@ -53,11 +53,12 @@ This project incorporates components from the projects listed below. The origina
|
|||
- @babel/plugin-syntax-private-property-in-object@7.14.5 (https://github.com/babel/babel)
|
||||
- @babel/plugin-syntax-typescript@7.20.0 (https://github.com/babel/babel)
|
||||
- @babel/plugin-transform-modules-commonjs@7.19.6 (https://github.com/babel/babel)
|
||||
- @babel/plugin-transform-react-jsx@7.20.7 (https://github.com/babel/babel)
|
||||
- @babel/plugin-transform-typescript@7.20.2 (https://github.com/babel/babel)
|
||||
- @babel/preset-typescript@7.18.6 (https://github.com/babel/babel)
|
||||
- @babel/template@7.18.10 (https://github.com/babel/babel)
|
||||
- @babel/traverse@7.20.1 (https://github.com/babel/babel)
|
||||
- @babel/types@7.20.2 (https://github.com/babel/babel)
|
||||
- @babel/types@7.20.7 (https://github.com/babel/babel)
|
||||
- @jest/types@27.5.1 (https://github.com/facebook/jest)
|
||||
- @jridgewell/gen-mapping@0.1.1 (https://github.com/jridgewell/gen-mapping)
|
||||
- @jridgewell/gen-mapping@0.3.2 (https://github.com/jridgewell/gen-mapping)
|
||||
|
|
@ -1634,6 +1635,33 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
=========================================
|
||||
END OF @babel/plugin-transform-modules-commonjs@7.19.6 AND INFORMATION
|
||||
|
||||
%% @babel/plugin-transform-react-jsx@7.20.7 NOTICES AND INFORMATION BEGIN HERE
|
||||
=========================================
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
=========================================
|
||||
END OF @babel/plugin-transform-react-jsx@7.20.7 AND INFORMATION
|
||||
|
||||
%% @babel/plugin-transform-typescript@7.20.2 NOTICES AND INFORMATION BEGIN HERE
|
||||
=========================================
|
||||
MIT License
|
||||
|
|
@ -1742,7 +1770,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
=========================================
|
||||
END OF @babel/traverse@7.20.1 AND INFORMATION
|
||||
|
||||
%% @babel/types@7.20.2 NOTICES AND INFORMATION BEGIN HERE
|
||||
%% @babel/types@7.20.7 NOTICES AND INFORMATION BEGIN HERE
|
||||
=========================================
|
||||
MIT License
|
||||
|
||||
|
|
@ -1767,7 +1795,7 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
=========================================
|
||||
END OF @babel/types@7.20.2 AND INFORMATION
|
||||
END OF @babel/types@7.20.7 AND INFORMATION
|
||||
|
||||
%% @jest/types@27.5.1 NOTICES AND INFORMATION BEGIN HERE
|
||||
=========================================
|
||||
|
|
@ -3813,6 +3841,6 @@ END OF update-browserslist-db@1.0.10 AND INFORMATION
|
|||
|
||||
SUMMARY BEGIN HERE
|
||||
=========================================
|
||||
Total Packages: 130
|
||||
Total Packages: 131
|
||||
=========================================
|
||||
END OF SUMMARY
|
||||
|
|
@ -23,10 +23,10 @@
|
|||
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
||||
"@babel/plugin-syntax-async-generators": "^7.8.4",
|
||||
"@babel/plugin-syntax-json-strings": "^7.8.3",
|
||||
"@babel/plugin-syntax-jsx": "^7.18.6",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.19.6",
|
||||
"@babel/plugin-transform-react-jsx": "^7.20.7",
|
||||
"@babel/preset-typescript": "^7.18.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
@ -675,6 +675,24 @@
|
|||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-react-jsx": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz",
|
||||
"integrity": "sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ==",
|
||||
"dependencies": {
|
||||
"@babel/helper-annotate-as-pure": "^7.18.6",
|
||||
"@babel/helper-module-imports": "^7.18.6",
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/plugin-syntax-jsx": "^7.18.6",
|
||||
"@babel/types": "^7.20.7"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
}
|
||||
},
|
||||
"node_modules/@babel/plugin-transform-typescript": {
|
||||
"version": "7.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.20.2.tgz",
|
||||
|
|
@ -741,9 +759,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@babel/types": {
|
||||
"version": "7.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz",
|
||||
"integrity": "sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog==",
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz",
|
||||
"integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.19.4",
|
||||
"@babel/helper-validator-identifier": "^7.19.1",
|
||||
|
|
@ -1539,6 +1557,18 @@
|
|||
"@babel/helper-simple-access": "^7.19.4"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-react-jsx": {
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.20.7.tgz",
|
||||
"integrity": "sha512-Tfq7qqD+tRj3EoDhY00nn2uP2hsRxgYGi5mLQ5TimKav0a9Lrpd4deE+fcLXU8zFYRjlKPHZhpCvfEA6qnBxqQ==",
|
||||
"requires": {
|
||||
"@babel/helper-annotate-as-pure": "^7.18.6",
|
||||
"@babel/helper-module-imports": "^7.18.6",
|
||||
"@babel/helper-plugin-utils": "^7.20.2",
|
||||
"@babel/plugin-syntax-jsx": "^7.18.6",
|
||||
"@babel/types": "^7.20.7"
|
||||
}
|
||||
},
|
||||
"@babel/plugin-transform-typescript": {
|
||||
"version": "7.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.20.2.tgz",
|
||||
|
|
@ -1587,9 +1617,9 @@
|
|||
}
|
||||
},
|
||||
"@babel/types": {
|
||||
"version": "7.20.2",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.2.tgz",
|
||||
"integrity": "sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog==",
|
||||
"version": "7.20.7",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.7.tgz",
|
||||
"integrity": "sha512-69OnhBxSSgK0OzTJai4kyPDiKTIe3j+ctaHdIGVbRahTLAT7L3R9oeXHC2aVSuGYt3cVnoAMDmOCgJ2yaiLMvg==",
|
||||
"requires": {
|
||||
"@babel/helper-string-parser": "^7.19.4",
|
||||
"@babel/helper-validator-identifier": "^7.19.1",
|
||||
|
|
|
|||
|
|
@ -24,10 +24,10 @@
|
|||
"@babel/plugin-proposal-private-property-in-object": "^7.18.6",
|
||||
"@babel/plugin-syntax-async-generators": "^7.8.4",
|
||||
"@babel/plugin-syntax-json-strings": "^7.8.3",
|
||||
"@babel/plugin-syntax-jsx": "^7.18.6",
|
||||
"@babel/plugin-syntax-object-rest-spread": "^7.8.3",
|
||||
"@babel/plugin-syntax-optional-catch-binding": "^7.8.3",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.19.6",
|
||||
"@babel/plugin-transform-react-jsx": "^7.20.7",
|
||||
"@babel/preset-typescript": "^7.18.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ export function babelTransform(filename: string, isTypeScript: boolean, isModule
|
|||
}
|
||||
|
||||
// Support JSX/TSX at all times, regardless of the file extension.
|
||||
plugins.push([require('@babel/plugin-syntax-jsx')]);
|
||||
plugins.push([require('@babel/plugin-transform-react-jsx')]);
|
||||
|
||||
if (!isModule) {
|
||||
plugins.push([require('@babel/plugin-transform-modules-commonjs')]);
|
||||
|
|
|
|||
|
|
@ -472,6 +472,40 @@ test('should load a jsx/tsx files', async ({ runInlineTest }) => {
|
|||
expect(exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('should load a jsx/tsx files with fragments', async ({ runInlineTest }) => {
|
||||
const { exitCode, passed } = await runInlineTest({
|
||||
'helper.tsx': `
|
||||
export const component = () => <><div></div></>;
|
||||
export function add(a: number, b: number) {
|
||||
return a + b;
|
||||
}
|
||||
`,
|
||||
'helper2.jsx': `
|
||||
const component = () => <><div></div></>;
|
||||
function add(a, b) {
|
||||
return a + b;
|
||||
}
|
||||
module.exports = { add, component }
|
||||
`,
|
||||
'a.spec.ts': `
|
||||
import { add } from './helper';
|
||||
const { test } = pwt;
|
||||
test('succeeds', () => {
|
||||
expect(add(1, 1)).toBe(2);
|
||||
});
|
||||
`,
|
||||
'b.spec.js': `
|
||||
const { add } = require('./helper2');
|
||||
const { test } = pwt;
|
||||
test('succeeds', () => {
|
||||
expect(add(1, 1)).toBe(2);
|
||||
});
|
||||
`
|
||||
});
|
||||
expect(passed).toBe(2);
|
||||
expect(exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('should remove type imports from ts', async ({ runInlineTest }) => {
|
||||
const result = await runInlineTest({
|
||||
'a.test.ts': `
|
||||
|
|
|
|||
Loading…
Reference in a new issue