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
5 changed files
with
81 additions
and
62 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`fixtures demo 1`] = ` | ||
"demo | ||
dist | ||
demo.js | ||
demo.js.map | ||
demo.m.js | ||
demo.m.js.map | ||
demo.umd.js | ||
demo.umd.js.map | ||
src | ||
index.js | ||
two.js | ||
Build output to dist: | ||
225 B: demo.js | ||
225 B: demo.m.js | ||
295 B: demo.umd.js" | ||
`; | ||
|
||
exports[`fixtures ts-demo 1`] = ` | ||
"ts-demo | ||
dist | ||
ts-demo.js | ||
ts-demo.js.map | ||
ts-demo.m.js | ||
ts-demo.m.js.map | ||
ts-demo.umd.js | ||
ts-demo.umd.js.map | ||
src | ||
car.ts | ||
index.ts | ||
Build output to dist: | ||
106 B: ts-demo.js | ||
106 B: ts-demo.m.js | ||
175 B: ts-demo.umd.js" | ||
`; |
This file was deleted.
Oops, something went wrong.
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,39 @@ | ||
import path from 'path'; | ||
import fs from 'fs-extra'; | ||
import dirTree from 'directory-tree'; | ||
import { strip } from './lib/util'; | ||
import microbundle from '../src/index'; | ||
|
||
const FIXTURES_DIR = `${__dirname}/fixtures`; | ||
|
||
const times = (n, fn) => Array.from({ length: n }).map(i => fn(i)); | ||
const join = (arr, delimiter = '') => arr.join(delimiter); | ||
const constant = konst => () => konst; | ||
|
||
const printTree = (nodes, indentLevel = 0) => { | ||
const indent = join(times(indentLevel, constant(' '))); | ||
return join(nodes.map(node => | ||
`${indent}${node.name}\n${node.type === 'directory' ? printTree(node.children, indentLevel + 1) : ''}` | ||
)); | ||
}; | ||
|
||
describe('fixtures', () => { | ||
fs.readdirSync(FIXTURES_DIR).forEach(fixtureDir => { | ||
const fixturePath = path.resolve(path.join(FIXTURES_DIR, fixtureDir)); | ||
|
||
if (!fs.statSync(fixturePath).isDirectory()) { | ||
return; | ||
} | ||
|
||
it(fixtureDir, async () => { | ||
const output = await microbundle({ | ||
cwd: path.resolve(fixturePath), | ||
formats: 'es,cjs,umd' | ||
}); | ||
|
||
const printedDir = printTree([dirTree(fixturePath)]); | ||
|
||
expect(`${printedDir}\n\n${strip(output)}`).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.