Skip to content

Commit

Permalink
chore: update test case
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Apr 19, 2023
1 parent 717909a commit d0d626a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/integration/clean-dist-path/tests/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import path from 'path';
import { writeFileSync, existsSync } from 'fs';
import { fs } from '@modern-js/utils';
import { modernBuild } from '../../../utils/modernTestUtils';

describe('clean dist path', () => {
it(`should not clean dist path when output.cleanDistPath is false`, async () => {
const appDir = path.resolve(__dirname, '..');
const tempFile = path.join(appDir, 'dist', 'foo.txt');
writeFileSync(tempFile, 'foo');
const tempFile = path.join(appDir, 'dist/foo.txt');
const htmlFile = path.join(appDir, 'dist/html/main/index.html');
fs.outputFileSync(tempFile, 'foo');
await modernBuild(appDir);
expect(existsSync(tempFile)).toBeTruthy();
expect(fs.existsSync(tempFile)).toBeTruthy();
expect(fs.existsSync(htmlFile)).toBeTruthy();
});
});

0 comments on commit d0d626a

Please sign in to comment.