-
Notifications
You must be signed in to change notification settings - Fork 916
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snowpack install package-es-module-shims: cli output 1`] = ` | ||
"[snowpack] snowpack - A faster build system for the modern web. | ||
Snowpack is best configured via config file. | ||
But, most configuration can also be passed via CLI flags. | ||
📖 https://www.snowpack.dev/#configuration | ||
Commands: | ||
snowpack init Create a new project config file. | ||
snowpack dev Develop your app locally. | ||
snowpack build Build your app for production. | ||
snowpack install (Advanced) Install web-ready dependencies. | ||
Flags: | ||
--config [path] Set the location of your project config file. | ||
--help Show this help message. | ||
--version Show the current version. | ||
--reload Clear Snowpack's local cache (troubleshooting). | ||
--verbose View debug info (where available) | ||
--quiet Don’t output anything (dev server will still log minimally)" | ||
`; |
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 @@ | ||
const { | ||
rollupPluginStripSourceMapping, | ||
} = require('../esinstall/lib/rollup-plugins/rollup-plugin-strip-source-mapping.js'); | ||
|
||
describe('snowpack:rollup-plugin-strip-source-mapping', () => { | ||
const tests = [ | ||
{ | ||
name: 'inline', | ||
given: `console.log('foo');//# sourceMappingURL=js.map.js`, | ||
expected: `console.log('foo');`, | ||
}, | ||
{ | ||
name: 'end of file', | ||
given: `console.log('foo'); | ||
//# sourceMappingURL=js.map.js`, | ||
expected: `console.log('foo'); | ||
`, | ||
}, | ||
{ | ||
name: 'middle of file', | ||
given: `console.log('foo'); | ||
//# sourceMappingURL=js.map.js | ||
console.log('bar'); | ||
//# sourceMappingURL=js.map.js`, | ||
expected: `console.log('foo'); | ||
console.log('bar'); | ||
`, | ||
}, | ||
{ | ||
name: 'inside string', // leave alone | ||
given: `const myString ='//# sourceMappingURL=js.map.js';`, | ||
expected: `const myString ='//# sourceMappingURL=js.map.js';`, | ||
}, | ||
{ | ||
name: 'es-module-shim', // leave alone | ||
given: ` sourceMappingResolved = \`\n//# sourceMappingURL=\` + resolveUrl(sourceMapping.slice(21), load.r);`, | ||
expected: ` sourceMappingResolved = \`\n//# sourceMappingURL=\` + resolveUrl(sourceMapping.slice(21), load.r);`, | ||
}, | ||
]; | ||
|
||
const {transform} = rollupPluginStripSourceMapping(); | ||
|
||
tests.forEach(({name, given, expected}) => { | ||
it(name, () => { | ||
expect(transform(given).code).toBe(expected); | ||
}); | ||
}); | ||
}); |