Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rynpsc committed Mar 30, 2019
1 parent 74d84c9 commit 53f0329
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 0 deletions.
@@ -0,0 +1,3 @@
body {
color: rebeccapurple;
}
@@ -0,0 +1,3 @@
body {
color: rebeccapurple;
}
30 changes: 30 additions & 0 deletions packages/core/integration-tests/test/sourcemaps.js
Expand Up @@ -476,6 +476,36 @@ describe('sourcemaps', function() {
await test(true);
});

it('should create correct sourceMappingURL', async function() {
const b = await bundle(
path.join(__dirname, '/integration/sourcemap-css/style.css')
);

const jsOutput = await fs.readFile(b.name, 'utf8');
assert(jsOutput.includes('//# sourceMappingURL=/style.css.map'));
});

it('should create correct sourceMappingURL with multiple entrypoints', async function() {
const b = await bundle([
path.join(
__dirname,
'/integration/sourcemap-css-multiple-entrypoints/a/style.css'
),
path.join(
__dirname,
'/integration/sourcemap-css-multiple-entrypoints/b/style.css'
)
]);

const bundle1 = [...b.childBundles][0];
const bundle2 = [...b.childBundles][1];
const jsOutput1 = await fs.readFile(bundle1.name, 'utf8');
const jsOutput2 = await fs.readFile(bundle2.name, 'utf8');

assert(jsOutput1.includes('//# sourceMappingURL=/a/style.css.map'));
assert(jsOutput2.includes('//# sourceMappingURL=/b/style.css.map'));
});

it('should create a valid sourcemap for a CSS bundle with imports', async function() {
async function test(minify) {
let b = await bundle(
Expand Down

0 comments on commit 53f0329

Please sign in to comment.