Skip to content

Commit

Permalink
fix: Correctly prevent printed cleanup error
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaninvents committed Mar 2, 2019
1 parent bb74b09 commit f77d0db
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
20 changes: 20 additions & 0 deletions src/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,26 @@ describe('@ryaninvents/plugin-bundle-dependencies', () => {
expect(archiveEntries).toMatchSnapshot();
}, 60e3);

it('should not produce ENOTEMPTY error', async () => {
const { workingDir } = await initRepo({
packageJson: {
...DEFAULT_PKG_JSON,
dependencies: {
// Use a couple of packages known to basically be one-liners
// in order to test quickly
'is-sorted': 'latest',
'map-obj': 'latest'
}
},
stdio: 'inherit'
});
const { stderr } = await execa('npm', ['run', 'build'], {
env: { NODE_ENV: 'production' },
cwd: workingDir
});
expect(stderr).not.toMatch('ENOTEMPTY');
}, 60e3);

it('should observe `prefix` option', async () => {
const { workingDir } = await initRepo({
packageJson: {
Expand Down
7 changes: 1 addition & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,5 @@ export async function build ({ cwd, out, manifest, reporter, options }) {

reporter.created(join(out, ZIP_FILENAME), `zip:dependencies`);

try {
await del([tempWorkingDir]);
} catch (er) {
// If this fails, it's not a big deal. We'll likely get a non-zero
// exit code though
}
await del([tempWorkingDir], { force: true });
}

0 comments on commit f77d0db

Please sign in to comment.