(plugins: ReturnType<typeof createPlugins>)
| 32 | } |
| 33 | |
| 34 | async function matchSnap(plugins: ReturnType<typeof createPlugins>) { |
| 35 | const { transformJs, transformWxml, transformWxss } = plugins |
| 36 | // const cssPath = path.resolve(gulpCasePath, '*.css') |
| 37 | |
| 38 | const cssTask = gulp |
| 39 | .src('./src/**/*.css', { |
| 40 | cwd: gulpCasePath, |
| 41 | }) |
| 42 | .pipe(transformWxss()) |
| 43 | |
| 44 | const result = await readContent(cssTask) |
| 45 | expect(normalizeSnapshotContent(result)).toMatchSnapshot('css') |
| 46 | await promisify(cssTask) |
| 47 | |
| 48 | const jsTask = gulp |
| 49 | .src('./src/**/*.js', { |
| 50 | cwd: gulpCasePath, |
| 51 | }) |
| 52 | .pipe(transformJs()) |
| 53 | |
| 54 | const wxmlTask = gulp |
| 55 | .src('./src/**/*.wxml', { |
| 56 | cwd: gulpCasePath, |
| 57 | }) |
| 58 | .pipe(transformWxml()) |
| 59 | |
| 60 | const ptasks = [jsTask, wxmlTask] |
| 61 | const [jsRes, wxmlRes] = await Promise.all(ptasks.map(element => readContent(element))) |
| 62 | expect(normalizeSnapshotContent(jsRes)).toMatchSnapshot('js') |
| 63 | expect(normalizeSnapshotContent(wxmlRes)).toMatchSnapshot('wxml') |
| 64 | await Promise.all(ptasks.map(element => promisify(element))) |
| 65 | } |
| 66 | describe('gulp', () => { |
| 67 | it('common build', async () => { |
| 68 | await matchSnap(createPlugins({ |
no test coverage detected