mirror of
https://github.com/developit/microbundle.git
synced 2026-01-18 13:56:35 +00:00
add optional chaining test
This commit is contained in:
parent
743338f42a
commit
65d9836e24
@ -13,6 +13,7 @@
|
||||
"prepare:babel": "babel src/*.js -d dist && npm t",
|
||||
"lint": "eslint src",
|
||||
"test": "npm run -s lint && npm run -s build && cross-env BABEL_ENV=test jest",
|
||||
"jest": "cross-env BABEL_ENV=test jest",
|
||||
"release": "npm run -s prepare && npm test && git commit -am $npm_package_version && git tag $npm_package_version && git push && git push --tags && npm publish"
|
||||
},
|
||||
"repository": "developit/microbundle",
|
||||
@ -83,6 +84,7 @@
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.7.7",
|
||||
"@babel/node": "^7.7.7",
|
||||
"@babel/plugin-proposal-optional-chaining": "^7.7.5",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.7.4",
|
||||
"babel-jest": "^24.8.0",
|
||||
"cross-env": "^6.0.3",
|
||||
|
||||
@ -1834,6 +1834,65 @@ exports[`fixtures build no-pkg-name with microbundle 5`] = `
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 1`] = `
|
||||
"Used script: microbundle
|
||||
|
||||
Directory tree:
|
||||
|
||||
optional-chaining-ts
|
||||
dist
|
||||
index.d.ts
|
||||
optional-chaining-ts.esm.js
|
||||
optional-chaining-ts.esm.js.map
|
||||
optional-chaining-ts.js
|
||||
optional-chaining-ts.js.map
|
||||
optional-chaining-ts.umd.js
|
||||
optional-chaining-ts.umd.js.map
|
||||
node_modules
|
||||
package.json
|
||||
src
|
||||
index.ts
|
||||
tsconfig.json
|
||||
|
||||
|
||||
Build \\"optionalChainingTs\\" to dist:
|
||||
104 B: optional-chaining-ts.js.gz
|
||||
77 B: optional-chaining-ts.js.br
|
||||
108 B: optional-chaining-ts.esm.js.gz
|
||||
92 B: optional-chaining-ts.esm.js.br
|
||||
207 B: optional-chaining-ts.umd.js.gz
|
||||
166 B: optional-chaining-ts.umd.js.br"
|
||||
`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 2`] = `7`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 3`] = `
|
||||
"export declare function chain(test: {
|
||||
maybeVar?: {
|
||||
thing: string;
|
||||
};
|
||||
}): string | undefined;
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 4`] = `
|
||||
"function n(n){var r;return null===(r=n.maybeVar)||void 0===r?void 0:r.thing}export{n as chain};
|
||||
//# sourceMappingURL=optional-chaining-ts.esm.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 5`] = `
|
||||
"exports.chain=function(n){var i;return null===(i=n.maybeVar)||void 0===i?void 0:i.thing};
|
||||
//# sourceMappingURL=optional-chaining-ts.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build optional-chaining-ts with microbundle 6`] = `
|
||||
"!function(n,e){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?e(exports):\\"function\\"==typeof define&&define.amd?define([\\"exports\\"],e):e((n=n||self).optionalChainingTs={})}(this,function(n){n.chain=function(n){var e;return null===(e=n.maybeVar)||void 0===e?void 0:e.thing}});
|
||||
//# sourceMappingURL=optional-chaining-ts.umd.js.map
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`fixtures build pretty with microbundle 1`] = `
|
||||
"Used script: microbundle
|
||||
|
||||
|
||||
10
test/fixtures/optional-chaining-ts/.babelrc
vendored
Normal file
10
test/fixtures/optional-chaining-ts/.babelrc
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"plugins": [
|
||||
[
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
{
|
||||
"loose": false
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
3
test/fixtures/optional-chaining-ts/package.json
vendored
Normal file
3
test/fixtures/optional-chaining-ts/package.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"name": "optional-chaining-ts"
|
||||
}
|
||||
3
test/fixtures/optional-chaining-ts/src/index.ts
vendored
Normal file
3
test/fixtures/optional-chaining-ts/src/index.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
export function chain(test: { maybeVar?: { thing: string } }): string | undefined {
|
||||
return test.maybeVar?.thing;
|
||||
}
|
||||
6
test/fixtures/optional-chaining-ts/tsconfig.json
vendored
Normal file
6
test/fixtures/optional-chaining-ts/tsconfig.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
},
|
||||
"files": ["src/index.ts"]
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user